Zend Lucene 行为不当:查询一项一项地工作,但不能一起工作
好吧,事情是这样的:Lucene 对我做了一些奇怪的事情。一切都正确索引,一切正常,一切都很快等等。
所以我搜索英语类别。数百个结果弹出。
所以我用英语搜索一个国家。数百个结果弹出。
所以我用英语搜索一个类别和一个国家。我知道的组合是有效的。我得到了杰克。没有什么。邮编....为什么?
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
$index = Library_Search_Lucene::open(SearchIndexer::getIndexDirectory());
$query = new Zend_Search_Lucene_Search_Query_Boolean();
$queryString = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryString->addTerm(new Zend_Search_Lucene_Index_Term('lang' . $language, 'langSite'));
$query->addSubquery($queryString, true);
if (isset($idCategory)) {
$queryCategory = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryCategory->addTerm(new Zend_Search_Lucene_Index_Term($idCategory, 'idCategory'));
$query->addSubquery($queryCategory, true);
}
if (isset($country)) {
$queryLocation = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryLocation->addTerm(new Zend_Search_Lucene_Index_Term($country, 'locationsClean'));
$query->addSubquery($queryLocation, true);
}
$hits = $index->find($query);
$query->getQueryTerms() 返回有效的术语数组。没有错误。我到底做错了什么?
Ok, so here's the deal: Lucene does the weirdes things to me. Everything is indexed properly, everything works, everything's fast etc etc.
So I search for a category in English. Hundreds of results pop out.
So I search for a country in English. Hundred of results pop out.
So I search for a category AND a country in English. A combination that I KNOW is valid. I get jack. Nothing. Zip.... Why?
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive());
$index = Library_Search_Lucene::open(SearchIndexer::getIndexDirectory());
$query = new Zend_Search_Lucene_Search_Query_Boolean();
$queryString = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryString->addTerm(new Zend_Search_Lucene_Index_Term('lang' . $language, 'langSite'));
$query->addSubquery($queryString, true);
if (isset($idCategory)) {
$queryCategory = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryCategory->addTerm(new Zend_Search_Lucene_Index_Term($idCategory, 'idCategory'));
$query->addSubquery($queryCategory, true);
}
if (isset($country)) {
$queryLocation = new Zend_Search_Lucene_Search_Query_MultiTerm();
$queryLocation->addTerm(new Zend_Search_Lucene_Index_Term($country, 'locationsClean'));
$query->addSubquery($queryLocation, true);
}
$hits = $index->find($query);
$query->getQueryTerms() returns a valid array of terms. There are no errors. What the hell am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们有完全相同的问题。它在 bugtracker 中注明,目前处于离线状态,但可以在 http://www.zendframework.com 找到/问题。
也许它会得到修复,但即便如此,速度也慢得令人痛苦。
We have exactly the same problem. It is noted in the bugtracker, which is currently offline, but can be found at http://www.zendframework.com/issues.
Maybe it will ever get fixed, but even then it is painfully slow.