source: sandbox/expresso-solr/expressoMail1_2/inc/solrclient/library/Solarium/Query/Select/Component/MoreLikeThis.php @ 7576

Revision 7576, 8.0 KB checked in by adir, 11 years ago (diff)

Ticket #000 - Adicionando a integracao de buscas com Solr na base a ser isnerida na comunidade

Line 
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 * MoreLikeThis component
41 *
42 * @link http://wiki.apache.org/solr/MoreLikeThis
43 *
44 * @package Solarium
45 * @subpackage Query
46 */
47class Solarium_Query_Select_Component_MoreLikeThis extends Solarium_Query_Select_Component
48{
49
50    /**
51     * Component type
52     *
53     * @var string
54     */
55    protected $_type = Solarium_Query_Select::COMPONENT_MORELIKETHIS;
56
57    /**
58     * Set fields option
59     *
60     * The fields to use for similarity. NOTE: if possible, these should have a
61     * stored TermVector
62     *
63     * Separate multiple fields with commas.
64     *
65     * @param string $fields
66     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
67     */
68    public function setFields($fields)
69    {
70        return $this->_setOption('fields', $fields);
71    }
72
73    /**
74     * Get fields option
75     *
76     * @return string|null
77     */
78    public function getFields()
79    {
80        return $this->getOption('fields');
81    }
82
83    /**
84     * Set minimumtermfrequency option
85     *
86     * Minimum Term Frequency - the frequency below which terms will be ignored
87     * in the source doc.
88     *
89     * @param int $minimum
90     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
91     */
92    public function setMinimumTermFrequency($minimum)
93    {
94        return $this->_setOption('minimumtermfrequency', $minimum);
95    }
96
97    /**
98     * Get minimumtermfrequency option
99     *
100     * @return integer|null
101     */
102    public function getMinimumTermFrequency()
103    {
104        return $this->getOption('minimumtermfrequency');
105    }
106
107    /**
108     * Set minimumdocumentfrequency option
109     *
110     * Minimum Document Frequency - the frequency at which words will be
111     * ignored which do not occur in at least this many docs.
112     *
113     * @param int $minimum
114     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
115     */
116    public function setMinimumDocumentFrequency($minimum)
117    {
118        return $this->_setOption('minimumdocumentfrequency', $minimum);
119    }
120
121    /**
122     * Get minimumdocumentfrequency option
123     *
124     * @return integer|null
125     */
126    public function getMinimumDocumentFrequency()
127    {
128        return $this->getOption('minimumdocumentfrequency');
129    }
130
131    /**
132     * Set minimumwordlength option
133     *
134     * Minimum word length below which words will be ignored.
135     *
136     * @param int $minimum
137     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
138     */
139    public function setMinimumWordLength($minimum)
140    {
141        return $this->_setOption('minimumwordlength', $minimum);
142    }
143
144    /**
145     * Get minimumwordlength option
146     *
147     * @return integer|null
148     */
149    public function getMinimumWordLength()
150    {
151        return $this->getOption('minimumwordlength');
152    }
153
154    /**
155     * Set maximumwordlength option
156     *
157     * Maximum word length above which words will be ignored.
158     *
159     * @param int $maximum
160     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
161     */
162    public function setMaximumWordLength($maximum)
163    {
164        return $this->_setOption('maximumwordlength', $maximum);
165    }
166
167    /**
168     * Get maximumwordlength option
169     *
170     * @return integer|null
171     */
172    public function getMaximumWordLength()
173    {
174        return $this->getOption('maximumwordlength');
175    }
176
177    /**
178     * Set maximumqueryterms option
179     *
180     * Maximum number of query terms that will be included in any generated
181     * query.
182     *
183     * @param int $maximum
184     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
185     */
186    public function setMaximumQueryTerms($maximum)
187    {
188        return $this->_setOption('maximumqueryterms', $maximum);
189    }
190
191    /**
192     * Get maximumqueryterms option
193     *
194     * @return integer|null
195     */
196    public function getMaximumQueryTerms()
197    {
198        return $this->getOption('maximumqueryterms');
199    }
200
201    /**
202     * Set maximumnumberoftokens option
203     *
204     * Maximum number of tokens to parse in each example doc field that is not
205     * stored with TermVector support.
206     *
207     * @param int $maximum
208     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
209     */
210    public function setMaximumNumberOfTokens($maximum)
211    {
212        return $this->_setOption('maximumnumberoftokens', $maximum);
213    }
214
215    /**
216     * Get maximumnumberoftokens option
217     *
218     * @return integer|null
219     */
220    public function getMaximumNumberOfTokens()
221    {
222        return $this->getOption('maximumnumberoftokens');
223    }
224
225    /**
226     * Set boost option
227     *
228     * If true the query will be boosted by the interesting term relevance.
229     *
230     * @param boolean $boost
231     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
232     */
233    public function setBoost($boost)
234    {
235        return $this->_setOption('boost', $boost);
236    }
237
238    /**
239     * Get boost option
240     *
241     * @return boolean|null
242     */
243    public function getBoost()
244    {
245        return $this->getOption('boost');
246    }
247
248    /**
249     * Set queryfields option
250     *
251     * Query fields and their boosts using the same format as that used in
252     * DisMaxQParserPlugin. These fields must also be specified in fields.
253     *
254     * Separate multiple fields with commas.
255     *
256     * @param string $queryFields
257     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
258     */
259    public function setQueryFields($queryFields)
260    {
261        return $this->_setOption('queryfields', $queryFields);
262    }
263
264    /**
265     * Get queryfields option
266     *
267     * @return string|null
268     */
269    public function getQueryFields()
270    {
271        return $this->getOption('queryfields');
272    }
273
274    /**
275     * Set count option
276     *
277     * The number of similar documents to return for each result
278     *
279     * @param int $count
280     * @return Solarium_Query_Select_Component_MoreLikeThis Provides fluent interface
281     */
282    public function setCount($count)
283    {
284        return $this->_setOption('count', $count);
285    }
286
287    /**
288     * Get count option
289     *
290     * @return int|null
291     */
292    public function getCount()
293    {
294        return $this->getOption('count');
295    }
296
297}
Note: See TracBrowser for help on using the repository browser.