ZF-6075: Range queries lead to Lucene Exception in ZF 1.7.7


Hi all. I updated today to the latest version (1.7.7) and found what I think is a bug: querying the index with a range term, produces an error: "Uncaught exception 'Zend_Search_Lucene_Exception' with message 'Terms per query limit is reached.' in .../Zend/Search/Lucene/Search/Query/Range.php:191 Stack trace: #0 .../Zend/Search/Lucene/Search/Query/Boolean.php(145): "

Code: $userQuery = Zend_Search_Lucene_Search_QueryParser::parse(convertSpecialCharacters($query)); $datesLimit = Zend_Search_Lucene_Search_QueryParser::parse('date:[20010101 TO 20090303]'); $query = new Zend_Search_Lucene_Search_Query_Boolean();

$query->addSubquery($datesLimit, true /* required /); $query->addSubquery($userQuery, true / required */);

$index = Zend_Search_Lucene::open($this->LuceneIndexLocation); $hits = $index->find($query);

Note: if the time frame between the dates is small (less than 1 year, for example) it works fine. Apparently, for each date in the range, a term is created, leading to a situation of count($terms) > getTermsPerQueryLimit() .

Tried Zend_Search_Lucene::setTermsPerQueryLimit(0) but still doesn't work.


Due to performance considerations the limit of matching terms is set for range, wildcard and fuzzy queries.

This limit can be retrieved/set using Zend_Search_Lucene::getTermsPerQueryLimit()/Zend_Search_Lucene::setTermsPerQueryLimit($limit) methods.