Zend Lucene 行为不当:查询一项一项地工作,但不能一起工作

发布于 2024-08-06 15:55:26 字数 1219 浏览 3 评论 0原文

好吧,事情是这样的: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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心是晴朗的。 2024-08-13 15:55:26

我们有完全相同的问题。它在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文