我正在使用 zend_search_lucene 在文档中搜索关键字。在其中一份文件中有短语This taught me a valuable lesson in time management as I still had to attend lectures and tutorials during the day. I enjoyed improving my telephone manner and learning to deal with different reactions to my requests for donations.
现在,如果搜索“关于时间管理的宝贵课程”,它会一无所获。我正在使用下面的代码来搜索它。
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
$index = new Zend_Search_Lucene('/home/project/mgh/data/search_file/lucene.customer.index');
Zend_Search_Lucene::getDefaultSearchField('contents');
$results = $index->find('contents:"valuable lesson on cost management" ');
$this->count=count($results);
在上面的例子中,只有不匹配是,代替'in'有'on',但剩余的单词正在匹配。如果匹配的单词很少(即使很少的单词不匹配),如何获得结果计数?
感谢您的建议。
参考: http: //framework.zend.com/manual/en/zend.search.lucene.query-language.html