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

Revision 7576, 7.2 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 * Highlighting per-field settings
41 *
42 * @link http://wiki.apache.org/solr/HighlightingParameters
43 *
44 * @package Solarium
45 * @subpackage Query
46 */
47class Solarium_Query_Select_Component_Highlighting_Field extends Solarium_Query_Select_Component
48{
49    /**
50     * Value for fragmenter option gap
51     */
52    const FRAGMENTER_GAP = 'gap';
53
54    /**
55     * Value for fragmenter option regex
56     */
57    const FRAGMENTER_REGEX = 'regex';
58
59    /**
60     * Get name option
61     *
62     * @return string|null
63     */
64    public function getName()
65    {
66        return $this->getOption('name');
67    }
68
69    /**
70     * Set name option
71     *
72     * @param string $name
73     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
74     */
75    public function setName($name)
76    {
77        return $this->_setOption('name', $name);
78    }
79
80    /**
81     * Set snippets option
82     *
83     * Maximum number of snippets per field
84     *
85     * @param int $maximum
86     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
87     */
88    public function setSnippets($maximum)
89    {
90        return $this->_setOption('snippets', $maximum);
91    }
92
93    /**
94     * Get snippets option
95     *
96     * @return int|null
97     */
98    public function getSnippets()
99    {
100        return $this->getOption('snippets');
101    }
102
103    /**
104     * Set fragsize option
105     *
106     * The size, in characters, of fragments to consider for highlighting
107     *
108     * @param int $size
109     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
110     */
111    public function setFragSize($size)
112    {
113        return $this->_setOption('fragsize', $size);
114    }
115
116    /**
117     * Get fragsize option
118     *
119     * @return int|null
120     */
121    public function getFragSize()
122    {
123        return $this->getOption('fragsize');
124    }
125
126    /**
127     * Set mergeContiguous option
128     *
129     * Collapse contiguous fragments into a single fragment
130     *
131     * @param boolean $merge
132     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
133     */
134    public function setMergeContiguous($merge)
135    {
136        return $this->_setOption('mergecontiguous', $merge);
137    }
138
139    /**
140     * Get mergeContiguous option
141     *
142     * @return boolean|null
143     */
144    public function getMergeContiguous()
145    {
146        return $this->getOption('mergecontiguous');
147    }
148
149    /**
150     * Set alternatefield option
151     *
152     * @param string $field
153     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
154     */
155    public function setAlternateField($field)
156    {
157        return $this->_setOption('alternatefield', $field);
158    }
159
160    /**
161     * Get alternatefield option
162     *
163     * @return string|null
164     */
165    public function getAlternateField()
166    {
167        return $this->getOption('alternatefield');
168    }
169
170    /**
171     * Set formatter option
172     *
173     * @param string $formatter
174     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
175     */
176    public function setFormatter($formatter = 'simple')
177    {
178        return $this->_setOption('formatter', $formatter);
179    }
180
181    /**
182     * Get formatter option
183     *
184     * @return string|null
185     */
186    public function getFormatter()
187    {
188        return $this->getOption('formatter');
189    }
190
191    /**
192     * Set simple prefix option
193     *
194     * Solr option h1.simple.pre
195     *
196     * @param string $prefix
197     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
198     */
199    public function setSimplePrefix($prefix)
200    {
201        return $this->_setOption('simpleprefix', $prefix);
202    }
203
204    /**
205     * Get simple prefix option
206     *
207     * Solr option hl.simple.pre
208     *
209     * @return string|null
210     */
211    public function getSimplePrefix()
212    {
213        return $this->getOption('simpleprefix');
214    }
215
216    /**
217     * Set simple postfix option
218     *
219     * Solr option h1.simple.post
220     *
221     * @param string $postfix
222     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
223     */
224    public function setSimplePostfix($postfix)
225    {
226        return $this->_setOption('simplepostfix', $postfix);
227    }
228
229    /**
230     * Get simple postfix option
231     *
232     * Solr option hl.simple.post
233     *
234     * @return string|null
235     */
236    public function getSimplePostfix()
237    {
238        return $this->getOption('simplepostfix');
239    }
240
241    /**
242     * Set fragmenter option
243     *
244     * Use one of the constants as value.
245     *
246     * @param string $fragmenter
247     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
248     */
249    public function setFragmenter($fragmenter)
250    {
251        return $this->_setOption('fragmenter', $fragmenter);
252    }
253
254    /**
255     * Get fragmenter option
256     *
257     * @return string|null
258     */
259    public function getFragmenter()
260    {
261        return $this->getOption('fragmenter');
262    }
263
264    /**
265     * Set useFastVectorHighlighter option
266     *
267     * @param boolean $use
268     * @return Solarium_Query_Select_Component_Highlighting Provides fluent interface
269     */
270    public function setUseFastVectorHighlighter($use)
271    {
272        return $this->_setOption('usefastvectorhighlighter', $use);
273    }
274
275    /**
276     * Get useFastVectorHighlighter option
277     *
278     * @return boolean|null
279     */
280    public function getUseFastVectorHighlighter()
281    {
282        return $this->getOption('usefastvectorhighlighter');
283    }
284
285}
Note: See TracBrowser for help on using the repository browser.