PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Term Query

Term queries can be used for searching with a single term.

Query string:

word1

or

Query construction by API:

<?php
$term  
= new Zend_Search_Lucene_Index_Term('word1''field1');
$query = new Zend_Search_Lucene_Search_Query_Term($term);
$hits  $index->find($query);

The term field is optional. Zend_Search_Lucene searches through all indexed fields in each document if the field is not specified:

<?php
// Search for 'word1' in all indexed fields
$term  = new Zend_Search_Lucene_Index_Term('word1');
$query = new Zend_Search_Lucene_Search_Query_Term($term);
$hits  $index->find($query);

Zend Framework