File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88abstract class Stop implements \Spameri \ElasticQuery \Mapping \FilterInterface
99{
1010
11+
12+ /**
13+ * @var array<string>
14+ */
15+ private $ extraWords ;
16+
17+
18+ public function __construct (
19+ array $ extraWords = []
20+ )
21+ {
22+ $ this ->extraWords = $ extraWords ;
23+ }
24+
25+
1126 public function getType () : string
1227 {
1328 return 'stop ' ;
@@ -17,6 +32,9 @@ public function getType() : string
1732 abstract public function getStopWords () : array ;
1833
1934
35+ abstract public function getName () : string ;
36+
37+
2038 public function key () : string
2139 {
2240 return $ this ->getName ();
@@ -25,10 +43,15 @@ public function key() : string
2543
2644 public function toArray () : array
2745 {
46+ $ stopWords = $ this ->getStopWords ();
47+ if ($ this ->extraWords ) {
48+ $ stopWords += $ this ->extraWords ;
49+ }
50+
2851 return [
2952 $ this ->getName () => [
3053 'type ' => $ this ->getType (),
31- 'stopwords ' => $ this -> getStopWords () ,
54+ 'stopwords ' => $ stopWords ,
3255 ],
3356 ];
3457 }
You can’t perform that action at this time.
0 commit comments