Searching for multiple words in on field in Lucene index
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()
);
精彩评论