【发布时间】:2012-06-04 10:10:57
【问题描述】:
我正在使用 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
【问题讨论】:
标签: php lucene full-text-search search-engine zend-search-lucene