您需要创建查询。您可以将其作为文本执行或使用查询 API(ofc vancy_state 必须在您的索引中):
title:"PHP" AND vacancy_state:1
或者使用 API 应该是这样的:
$query = new Zend_Search_Lucene_Search_Query_MultiTerm();
$query->addTerm(new Zend_Search_Lucene_Index_Term('PHP'), true);
$query->addTerm(new Zend_Search_Lucene_Index_Term(1, 'vacancy_state'), true);
$index->find($query);
或者
$query = new Zend_Search_Lucene_Search_Query_Boolean();
$term = new Zend_Search_Lucene_Index_Term('PHP');
$subquery = new Zend_Search_Lucene_Search_Query_Term($term);
$query->addSubquery($subquery, true);
$term = new Zend_Search_Lucene_Index_Term(1, 'vacancy_state');
$subquery = new Zend_Search_Lucene_Search_Query_Term($term);
$query->addSubquery($subquery, true);