We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 87c2b5a commit 83e26ebCopy full SHA for 83e26eb
1 file changed
src/Mapping/Filter/EdgeNgram.php
@@ -8,9 +8,48 @@
8
class EdgeNgram implements \Spameri\ElasticQuery\Mapping\FilterInterface
9
{
10
11
+ /**
12
+ * @var int
13
+ */
14
+ private $minGram;
15
+
16
17
18
19
+ private $maxGram;
20
21
22
+ public function __construct(
23
+ int $minGram = 2,
24
+ int $maxGram = 6
25
+ )
26
+ {
27
+ $this->minGram = $minGram;
28
+ $this->maxGram = $maxGram;
29
+ }
30
31
32
public function getType(): string
33
34
return 'edge_ngram';
35
}
36
37
38
+ public function key(): string
39
40
+ return 'customEdgeNgram';
41
42
43
44
+ public function toArray(): array
45
46
+ return [
47
+ $this->key() => [
48
+ 'type' => 'edge_ngram',
49
+ 'min_gram' => $this->minGram,
50
+ 'max_gram' => $this->maxGram,
51
+ ],
52
+ ];
53
54
55
0 commit comments