开发者

Searching for multiple words in on field in Lucene index

开发者 https://www.devze.com 2023-01-04 22:08 出处:网络
I\'m having problem with Zend_Search_Lucene. I have few documents with field \"tags\" in index. Documents \"tags\" h开发者_如何学Cave following values:

I'm having problem with Zend_Search_Lucene. I have few documents with field "tags" in index. Documents "tags" h开发者_如何学Cave following values:

  • tag1 tag2 tag3
  • tag1 tag4

I would like to find document only with tag1 AND tag4 so I use query "+tags:tag1 +tags:tag2". I can't figure out why I get 0 hits from index.


I resolved this problem. Default Zend_Search_Lucene analyzer skips digits. There is a special analyzer for this and it should be set as default before indexing and searching.

Zend_Search_Lucene_Analysis_Analyzer::setDefault(
    new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive()
);
0

精彩评论

暂无评论...
验证码 换一张
取 消