According to the documentation, Zend_Search_Lucene_Search_QueryParserException is thrown when there is an error in the query syntax.
So I checked out the source code, and this is where that error is thrown from:
$tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_rqFirstTerm, $this->_encoding);
if (count($tokens) > 1) {
require_once 'Zend/Search/Lucene/Search/QueryParserException.php';
throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms');
} else if (count($tokens) == 1) {
require_once 'Zend/Search/Lucene/Index/Term.php';
$from = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField());
} else {
$from = null;
}
$tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_currentToken->text, $this->_encoding);
if (count($tokens) > 1) {
require_once 'Zend/Search/Lucene/Search/QueryParserException.php';
throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms');
} else if (count($tokens) == 1) {
require_once 'Zend/Search/Lucene/Index/Term.php';
$to = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField());
} else {
$to = null;
}
This is contained in the openedRQLastTerm()
function which it will Process last range query term (opened interval).
After looking into what is wrong then with the query and why it can't tokenize it, I discovered a possible solution in the documentation concerning how to do ranged queries:
Range queries allow the developer or user to match documents whose field(s) values are between the lower and upper bound specified by the range query. Range Queries can be inclusive or exclusive of the upper and lower bounds. Sorting is performed lexicographically.
mod_date:[20020101 TO 20030101]
So, you may have some luck by removing the hyphens in your date. Also, consider something mentioned in a forum:
You have to switch default analyzer to TextNum before indexing and search. Default analyzer skips numbers:
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_TextNum_CaseInsensitive())
And also:
'publishDate' fields need to be set as 'keyword' while indexing,otherwise ranged query fetches no results.
Hopefully all of that information helps you solve your problem! Good luck.