If you pass a
wildcard term into an instance of Zend_Search_Lucene_Search_Query_Term, then it will be treated as a literal.
Phrase Query Phrase queries allow for searching for a specific multi-word phrase.
Example search: ???php is powerful???
$query = new Zend_Search_Lucene_Search_Query_Phrase(array('php', 'is', 'powerful'));
$hits = $index->find($query);
or
// separate Index_Term objects
$query = new Zend_Search_Lucene_Search_Query_Phrase();
$query->addTerm(new Zend_Search_Lucene_Index_Term('php'));
$query->addTerm(new Zend_Search_Lucene_Index_Term('is'));
$query->addTerm(new Zend_Search_Lucene_Index_Term('powerful'));
$hits = $index->find($query);
Licensed to Menshu You
Please post comments or corrections to the Author Online forum at
http://www.manning-sandbox.com/forum.jspa?forumID=329
The words that make up the query can be either specified in the constructor of the
Zend_Search_Lucene_Search_Query_Phrase object or each term can be added separately. You can also search with
???word??? wildcards so:
$query = new Zend_Search_Lucene_Search_Query_Phrase(array('php', 'powerful'), array(0, 2));
$hits = $index->find($query);
will find all three word phrases that have ???php??? as the first word and ???powerful??? as the last.
Pages:
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222