File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -21,11 +21,17 @@ class QueryCollection implements LeafQueryInterface
2121 */
2222 private $ mustNotCollection ;
2323
24+ /**
25+ * @var int|string|null
26+ */
27+ private $ key ;
28+
2429
2530 public function __construct (
2631 ?\Spameri \ElasticQuery \Query \MustCollection $ mustCollection = NULL
2732 , ?\Spameri \ElasticQuery \Query \ShouldCollection $ shouldCollection = NULL
2833 , ?\Spameri \ElasticQuery \Query \MustNotCollection $ mustNotCollection = NULL
34+ , $ key = NULL
2935 )
3036 {
3137 if ( ! $ mustCollection ) {
@@ -43,6 +49,7 @@ public function __construct(
4349 $ this ->mustCollection = $ mustCollection ;
4450 $ this ->shouldCollection = $ shouldCollection ;
4551 $ this ->mustNotCollection = $ mustNotCollection ;
52+ $ this ->key = $ key ;
4653 }
4754
4855
@@ -84,7 +91,11 @@ public function addShouldQuery(\Spameri\ElasticQuery\Query\LeafQueryInterface $l
8491
8592 public function key () : string
8693 {
87- return '' ;
94+ if ($ this ->key ) {
95+ return $ this ->key ;
96+ }
97+
98+ return \md5 (\serialize ($ this ->toArray ()));
8899 }
89100
90101
You can’t perform that action at this time.
0 commit comments