I am searching in an index using two different approaches, one is working, one is not (but should be from reading the documentation). I am wondering what my mistake is.
Here is my first approach which works fine:
$query = '+language:EN +country:US';
$hits = $index->find($query);
I tried to do the same using Zend_Search_Lucene_Index_Term
:
$query = new Zend_Search_Lucene_Search_Query_MultiTerm();
$query->addTerm(new Zend_Search_Lucene_Index_Term('EN', 'language'), true);
$query->addTerm(new Zend_Search_Lucene_Index_Term('US', 'country'), true);
$hits = $index->find($query);
This won't create a result. Removing the true
option converts the search into an OR search (country=US OR language=EN).
I based the creation of the second approach on the documentation found at http://framework.zend.com/manual/1.12/de/zend.search.lucene.query-api.html