1 | <?php |
---|
2 | /** |
---|
3 | * Copyright 2011 Bas de Nooijer. All rights reserved. |
---|
4 | * |
---|
5 | * Redistribution and use in source and binary forms, with or without |
---|
6 | * modification, are permitted provided that the following conditions are met: |
---|
7 | * |
---|
8 | * 1. Redistributions of source code must retain the above copyright notice, |
---|
9 | * this list of conditions and the following disclaimer. |
---|
10 | * |
---|
11 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
---|
12 | * this listof conditions and the following disclaimer in the documentation |
---|
13 | * and/or other materials provided with the distribution. |
---|
14 | * |
---|
15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" |
---|
16 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
---|
19 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
25 | * POSSIBILITY OF SUCH DAMAGE. |
---|
26 | * |
---|
27 | * The views and conclusions contained in the software and documentation are |
---|
28 | * those of the authors and should not be interpreted as representing official |
---|
29 | * policies, either expressed or implied, of the copyright holder. |
---|
30 | * |
---|
31 | * @copyright Copyright 2011 Bas de Nooijer <solarium@raspberry.nl> |
---|
32 | * @license http://github.com/basdenooijer/solarium/raw/master/COPYING |
---|
33 | * @link http://www.solarium-project.org/ |
---|
34 | * |
---|
35 | * @package Solarium |
---|
36 | * @subpackage Query |
---|
37 | */ |
---|
38 | |
---|
39 | /** |
---|
40 | * Spellcheck component |
---|
41 | * |
---|
42 | * @link http://wiki.apache.org/solr/SpellCheckComponent |
---|
43 | * |
---|
44 | * @package Solarium |
---|
45 | * @subpackage Query |
---|
46 | */ |
---|
47 | class Solarium_Query_Select_Component_Spellcheck extends Solarium_Query_Select_Component |
---|
48 | { |
---|
49 | /** |
---|
50 | * Component type |
---|
51 | * |
---|
52 | * @var string |
---|
53 | */ |
---|
54 | protected $_type = Solarium_Query_Select::COMPONENT_SPELLCHECK; |
---|
55 | |
---|
56 | /** |
---|
57 | * Set query option |
---|
58 | * |
---|
59 | * Query to spellcheck |
---|
60 | * |
---|
61 | * @param string $query |
---|
62 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
63 | */ |
---|
64 | public function setQuery($query) |
---|
65 | { |
---|
66 | return $this->_setOption('query', $query); |
---|
67 | } |
---|
68 | |
---|
69 | /** |
---|
70 | * Get query option |
---|
71 | * |
---|
72 | * @return string|null |
---|
73 | */ |
---|
74 | public function getQuery() |
---|
75 | { |
---|
76 | return $this->getOption('query'); |
---|
77 | } |
---|
78 | |
---|
79 | /** |
---|
80 | * Set build option |
---|
81 | * |
---|
82 | * Build the spellcheck? |
---|
83 | * |
---|
84 | * @param boolean $build |
---|
85 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
86 | */ |
---|
87 | public function setBuild($build) |
---|
88 | { |
---|
89 | return $this->_setOption('build', $build); |
---|
90 | } |
---|
91 | |
---|
92 | /** |
---|
93 | * Get build option |
---|
94 | * |
---|
95 | * @return boolean|null |
---|
96 | */ |
---|
97 | public function getBuild() |
---|
98 | { |
---|
99 | return $this->getOption('build'); |
---|
100 | } |
---|
101 | |
---|
102 | /** |
---|
103 | * Set reload option |
---|
104 | * |
---|
105 | * Reload the dictionary? |
---|
106 | * |
---|
107 | * @param boolean $reload |
---|
108 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
109 | */ |
---|
110 | public function setReload($reload) |
---|
111 | { |
---|
112 | return $this->_setOption('reload', $reload); |
---|
113 | } |
---|
114 | |
---|
115 | /** |
---|
116 | * Get fragsize option |
---|
117 | * |
---|
118 | * @return boolean|null |
---|
119 | */ |
---|
120 | public function getReload() |
---|
121 | { |
---|
122 | return $this->getOption('reload'); |
---|
123 | } |
---|
124 | |
---|
125 | /** |
---|
126 | * Set dictionary option |
---|
127 | * |
---|
128 | * The name of the dictionary to use |
---|
129 | * |
---|
130 | * @param string $dictionary |
---|
131 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
132 | */ |
---|
133 | public function setDictionary($dictionary) |
---|
134 | { |
---|
135 | return $this->_setOption('dictionary', $dictionary); |
---|
136 | } |
---|
137 | |
---|
138 | /** |
---|
139 | * Get dictionary option |
---|
140 | * |
---|
141 | * @return string|null |
---|
142 | */ |
---|
143 | public function getDictionary() |
---|
144 | { |
---|
145 | return $this->getOption('dictionary'); |
---|
146 | } |
---|
147 | |
---|
148 | /** |
---|
149 | * Set count option |
---|
150 | * |
---|
151 | * The maximum number of suggestions to return |
---|
152 | * |
---|
153 | * @param int $count |
---|
154 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
155 | */ |
---|
156 | public function setCount($count) |
---|
157 | { |
---|
158 | return $this->_setOption('count', $count); |
---|
159 | } |
---|
160 | |
---|
161 | /** |
---|
162 | * Get count option |
---|
163 | * |
---|
164 | * @return int|null |
---|
165 | */ |
---|
166 | public function getCount() |
---|
167 | { |
---|
168 | return $this->getOption('count'); |
---|
169 | } |
---|
170 | |
---|
171 | /** |
---|
172 | * Set onlyMorePopular option |
---|
173 | * |
---|
174 | * Only return suggestions that result in more hits for the query than the existing query |
---|
175 | * |
---|
176 | * @param boolean $onlyMorePopular |
---|
177 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
178 | */ |
---|
179 | public function setOnlyMorePopular($onlyMorePopular) |
---|
180 | { |
---|
181 | return $this->_setOption('onlymorepopular', $onlyMorePopular); |
---|
182 | } |
---|
183 | |
---|
184 | /** |
---|
185 | * Get onlyMorePopular option |
---|
186 | * |
---|
187 | * @return boolean|null |
---|
188 | */ |
---|
189 | public function getOnlyMorePopular() |
---|
190 | { |
---|
191 | return $this->getOption('onlymorepopular'); |
---|
192 | } |
---|
193 | |
---|
194 | /** |
---|
195 | * Set extendedResults option |
---|
196 | * |
---|
197 | * @param boolean $extendedResults |
---|
198 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
199 | */ |
---|
200 | public function setExtendedResults($extendedResults) |
---|
201 | { |
---|
202 | return $this->_setOption('extendedresults', $extendedResults); |
---|
203 | } |
---|
204 | |
---|
205 | /** |
---|
206 | * Get extendedResults option |
---|
207 | * |
---|
208 | * @return boolean|null |
---|
209 | */ |
---|
210 | public function getExtendedResults() |
---|
211 | { |
---|
212 | return $this->getOption('extendedresults'); |
---|
213 | } |
---|
214 | |
---|
215 | /** |
---|
216 | * Set collate option |
---|
217 | * |
---|
218 | * @param boolean $collate |
---|
219 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
220 | */ |
---|
221 | public function setCollate($collate) |
---|
222 | { |
---|
223 | return $this->_setOption('collate', $collate); |
---|
224 | } |
---|
225 | |
---|
226 | /** |
---|
227 | * Get collate option |
---|
228 | * |
---|
229 | * @return boolean|null |
---|
230 | */ |
---|
231 | public function getCollate() |
---|
232 | { |
---|
233 | return $this->getOption('collate'); |
---|
234 | } |
---|
235 | |
---|
236 | /** |
---|
237 | * Set maxCollations option |
---|
238 | * |
---|
239 | * @param int $maxCollations |
---|
240 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
241 | */ |
---|
242 | public function setMaxCollations($maxCollations) |
---|
243 | { |
---|
244 | return $this->_setOption('maxcollations', $maxCollations); |
---|
245 | } |
---|
246 | |
---|
247 | /** |
---|
248 | * Get maxCollations option |
---|
249 | * |
---|
250 | * @return int|null |
---|
251 | */ |
---|
252 | public function getMaxCollations() |
---|
253 | { |
---|
254 | return $this->getOption('maxcollations'); |
---|
255 | } |
---|
256 | |
---|
257 | /** |
---|
258 | * Set maxCollationTries option |
---|
259 | * |
---|
260 | * @param string $maxCollationTries |
---|
261 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
262 | */ |
---|
263 | public function setMaxCollationTries($maxCollationTries) |
---|
264 | { |
---|
265 | return $this->_setOption('maxcollationtries', $maxCollationTries); |
---|
266 | } |
---|
267 | |
---|
268 | /** |
---|
269 | * Get maxCollationTries option |
---|
270 | * |
---|
271 | * @return string|null |
---|
272 | */ |
---|
273 | public function getMaxCollationTries() |
---|
274 | { |
---|
275 | return $this->getOption('maxcollationtries'); |
---|
276 | } |
---|
277 | |
---|
278 | /** |
---|
279 | * Set maxCollationEvaluations option |
---|
280 | * |
---|
281 | * @param int $maxCollationEvaluations |
---|
282 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
283 | */ |
---|
284 | public function setMaxCollationEvaluations($maxCollationEvaluations) |
---|
285 | { |
---|
286 | return $this->_setOption('maxcollationevaluations', $maxCollationEvaluations); |
---|
287 | } |
---|
288 | |
---|
289 | /** |
---|
290 | * Get maxCollationEvaluations option |
---|
291 | * |
---|
292 | * @return int|null |
---|
293 | */ |
---|
294 | public function getMaxCollationEvaluations() |
---|
295 | { |
---|
296 | return $this->getOption('maxcollationevaluations'); |
---|
297 | } |
---|
298 | |
---|
299 | /** |
---|
300 | * Set collateExtendedResults option |
---|
301 | * |
---|
302 | * @param string $collateExtendedResults |
---|
303 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
304 | */ |
---|
305 | public function setCollateExtendedResults($collateExtendedResults) |
---|
306 | { |
---|
307 | return $this->_setOption('collateextendedresults', $collateExtendedResults); |
---|
308 | } |
---|
309 | |
---|
310 | /** |
---|
311 | * Get collateExtendedResults option |
---|
312 | * |
---|
313 | * @return string|null |
---|
314 | */ |
---|
315 | public function getCollateExtendedResults() |
---|
316 | { |
---|
317 | return $this->getOption('collateextendedresults'); |
---|
318 | } |
---|
319 | |
---|
320 | /** |
---|
321 | * Set accuracy option |
---|
322 | * |
---|
323 | * @param float $accuracy |
---|
324 | * @return Solarium_Query_Select_Component_Spellcheck Provides fluent interface |
---|
325 | */ |
---|
326 | public function setAccuracy($accuracy) |
---|
327 | { |
---|
328 | return $this->_setOption('accuracy', $accuracy); |
---|
329 | } |
---|
330 | |
---|
331 | /** |
---|
332 | * Get accuracy option |
---|
333 | * |
---|
334 | * @return float|null |
---|
335 | */ |
---|
336 | public function getAccuracy() |
---|
337 | { |
---|
338 | return $this->getOption('accuracy'); |
---|
339 | } |
---|
340 | |
---|
341 | } |
---|