File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php declare (strict_types = 1 );
2+
3+ namespace Spameri \ElasticQuery \Query ;
4+
5+ /**
6+ * Match all documents query.
7+ *
8+ * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-all-query.html
9+ */
10+ class MatchAll implements \Spameri \ElasticQuery \Query \LeafQueryInterface
11+ {
12+
13+ public function __construct (
14+ private float $ boost = 1.0 ,
15+ )
16+ {
17+ }
18+
19+
20+ public function key (): string
21+ {
22+ return 'match_all ' ;
23+ }
24+
25+
26+ /**
27+ * @return array<string, mixed>
28+ */
29+ public function toArray (): array
30+ {
31+ if ($ this ->boost !== 1.0 ) {
32+ return [
33+ 'match_all ' => [
34+ 'boost ' => $ this ->boost ,
35+ ],
36+ ];
37+ }
38+
39+ return [
40+ 'match_all ' => new \stdClass (),
41+ ];
42+ }
43+
44+ }
You can’t perform that action at this time.
0 commit comments