This is known as ???slop???
and you can also use the setSlop() function to achieve the same effect like this:
$query = new Zend_Search_Lucene_Search_Query_Phrase(array('php', 'powerful');
$query->setSlop(2);
$hits = $index->find($query);
Range Query Find all records within a particular range, usually date, but can be anything.
Example search: published_date:[20070101 to 20080101]
$from = new Zend_Search_Lucene_Index_Term('20070101', 'published_date');
$to = new Zend_Search_Lucene_Index_Term('20080101', 'published_date');
$query = new Zend_Search_Lucene_Search_Query_Range($from, $to, true /* inclusive */);
$hits = $index->find($query);
Either boundary may be null to imply ???from the beginning??? or ???until the end??? as appropriate.
Clearly the benefit of using the programmatic interface to Zend_Search_Lucene over the string parser is
that it??™s easier to clearly express search criteria exactly and allows the use of an ???advanced search??? web form
for the user to refine their search.
8.2.3 Best practices
We have now covered all you need to know about the using Zend_Search_Lucene, but before we move on to
implementing search into a real application, it will be beneficial to look at a few best practices for using
Zend_Search_Lucene.
Firstly, don??™t use id or score in field names as this will make them harder to retrieve again.
Pages:
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223