1 | <?php |
||
35 | class Slops implements ParameterBuilder |
||
36 | { |
||
37 | const NO_SLOP = null; |
||
38 | |||
39 | /** |
||
40 | * The qs parameter |
||
41 | * |
||
42 | * @var int |
||
43 | */ |
||
44 | protected $querySlop = self::NO_SLOP; |
||
45 | |||
46 | /** |
||
47 | * @var int |
||
48 | */ |
||
49 | protected $phraseSlop = self::NO_SLOP; |
||
50 | |||
51 | /** |
||
52 | * @var int |
||
53 | */ |
||
54 | protected $bigramPhraseSlop = self::NO_SLOP; |
||
55 | |||
56 | /** |
||
57 | * @var int |
||
58 | */ |
||
59 | protected $trigramPhraseSlop = self::NO_SLOP; |
||
60 | |||
61 | /** |
||
62 | * Slops constructor. |
||
63 | * @param int|null $querySlop |
||
64 | * @param int|null $phraseSlop |
||
65 | * @param int|null $bigramPhraseSlop |
||
66 | * @param int|null $trigramPhraseSlop |
||
67 | */ |
||
68 | public function __construct($querySlop = self::NO_SLOP, $phraseSlop = self::NO_SLOP, $bigramPhraseSlop = self::NO_SLOP, $trigramPhraseSlop = self::NO_SLOP) |
||
75 | |||
76 | /** |
||
77 | * @return int |
||
78 | */ |
||
79 | public function getQuerySlop(): int |
||
83 | |||
84 | /** |
||
85 | * @param int $querySlop |
||
86 | */ |
||
87 | public function setQuerySlop(int $querySlop) |
||
91 | |||
92 | /** |
||
93 | * @return int |
||
94 | */ |
||
95 | public function getPhraseSlop(): int |
||
99 | |||
100 | /** |
||
101 | * @param int $phraseSlop |
||
102 | */ |
||
103 | public function setPhraseSlop(int $phraseSlop) |
||
107 | |||
108 | /** |
||
109 | * @return int |
||
110 | */ |
||
111 | public function getBigramPhraseSlop(): int |
||
115 | |||
116 | /** |
||
117 | * @param int $bigramPhraseSlop |
||
118 | */ |
||
119 | public function setBigramPhraseSlop(int $bigramPhraseSlop) |
||
123 | |||
124 | /** |
||
125 | * @return int |
||
126 | */ |
||
127 | public function getTrigramPhraseSlop(): int |
||
131 | |||
132 | /** |
||
133 | * @param int $trigramPhraseSlop |
||
134 | */ |
||
135 | public function setTrigramPhraseSlop(int $trigramPhraseSlop) |
||
139 | |||
140 | /** |
||
141 | * @param Query $query |
||
142 | * @return Query |
||
143 | */ |
||
144 | public function build(Query $query): Query |
||
153 | |||
154 | /** |
||
155 | * @param TypoScriptConfiguration $solrConfiguration |
||
156 | * @return Slops |
||
157 | */ |
||
158 | public static function fromTypoScriptConfiguration(TypoScriptConfiguration $solrConfiguration) |
||
167 | |||
168 | /** |
||
169 | * @param array $searchConfiguration |
||
170 | * @return int|null |
||
171 | */ |
||
172 | protected static function getPhraseSlopFromConfiguration($searchConfiguration) |
||
178 | |||
179 | /** |
||
180 | * @param array $searchConfiguration |
||
181 | * @return int|null |
||
182 | */ |
||
183 | protected static function getQuerySlopFromConfiguration($searchConfiguration) |
||
189 | |||
190 | /** |
||
191 | * @param array $searchConfiguration |
||
192 | * @return int|null |
||
193 | */ |
||
194 | protected static function getBigramPhraseSlopFromConfiguration($searchConfiguration) |
||
200 | |||
201 | /** |
||
202 | * @param array $searchConfiguration |
||
203 | * @return int|null |
||
204 | */ |
||
205 | protected static function getTrigramPhraseSlopFromConfiguration($searchConfiguration) |
||
211 | } |