Skip to content

Commit b91448e

Browse files
committed
Added slop MultiMatch query
1 parent 81b494d commit b91448e

File tree

1 file changed

+20
-36
lines changed

1 file changed

+20
-36
lines changed

src/Query/MultiMatch.php

Lines changed: 20 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,59 +9,41 @@
99
class MultiMatch implements LeafQueryInterface
1010
{
1111

12-
/**
13-
* @var array
14-
*/
15-
private $fields;
12+
private array $fields;
1613

1714
/**
1815
* @var string|int|bool|null
1916
*/
2017
private $query;
2118

22-
/**
23-
* @var string
24-
*/
25-
private $type;
19+
private string $type;
2620

27-
/**
28-
* @var string
29-
*/
30-
private $operator;
21+
private string $operator;
3122

32-
/**
33-
* @var null|\Spameri\ElasticQuery\Query\Match\Fuzziness
34-
*/
35-
private $fuzziness;
23+
private ?\Spameri\ElasticQuery\Query\Match\Fuzziness $fuzziness;
3624

37-
/**
38-
* @var float
39-
*/
40-
private $boost;
25+
private float $boost;
4126

42-
/**
43-
* @var null|string
44-
*/
45-
private $analyzer;
27+
private ?string $analyzer;
4628

47-
/**
48-
* @var int|null
49-
*/
50-
private $minimumShouldMatch;
29+
private ?int $minimumShouldMatch;
30+
31+
private int $slop;
5132

5233

5334
/**
5435
* @param string|int|bool|null $query
5536
*/
5637
public function __construct(
57-
array $fields
58-
, $query
59-
, float $boost = 1.0
60-
, string $type = \Spameri\ElasticQuery\Query\Match\MultiMatchType::BEST_FIELDS
61-
, string $operator = \Spameri\ElasticQuery\Query\Match\Operator::OR
62-
, ?\Spameri\ElasticQuery\Query\Match\Fuzziness $fuzziness = NULL
63-
, ?string $analyzer = NULL
64-
, ?int $minimumShouldMatch = NULL
38+
array $fields,
39+
$query,
40+
float $boost = 1.0,
41+
int $slop = 1,
42+
?\Spameri\ElasticQuery\Query\Match\Fuzziness $fuzziness = NULL,
43+
string $type = \Spameri\ElasticQuery\Query\Match\MultiMatchType::BEST_FIELDS,
44+
?int $minimumShouldMatch = NULL,
45+
string $operator = \Spameri\ElasticQuery\Query\Match\Operator::OR,
46+
?string $analyzer = NULL
6547
)
6648
{
6749
if ( ! \in_array($operator, \Spameri\ElasticQuery\Query\Match\Operator::OPERATORS, TRUE)) {
@@ -83,6 +65,7 @@ public function __construct(
8365
$this->boost = $boost;
8466
$this->analyzer = $analyzer;
8567
$this->minimumShouldMatch = $minimumShouldMatch;
68+
$this->slop = $slop;
8669
}
8770

8871

@@ -98,6 +81,7 @@ public function toArray(): array
9881
'multi_match' => [
9982
'query' => $this->query,
10083
'type' => $this->type,
84+
'slop' => $this->slop,
10185
'fields' => $this->fields,
10286
'boost' => $this->boost,
10387
],

0 commit comments

Comments
 (0)