/** * Process last range query term (closed interval) * * @throws Zend_Search_Lucene_Search_QueryParserException */ public function closedRQLastTerm() { $tokens = Zend_Search_Lucene_Analysis_Analyzer::getDefault()->tokenize($this->_rqFirstTerm, $this->_encoding); if (count($tokens) > 1) { throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); } else { if (count($tokens) == 1) { $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) { throw new Zend_Search_Lucene_Search_QueryParserException('Range query boundary terms must be non-multiple word terms'); } else { if (count($tokens) == 1) { $to = new Zend_Search_Lucene_Index_Term(reset($tokens)->getTermText(), $this->_context->getField()); } else { $to = null; } } if ($from === null && $to === null) { throw new Zend_Search_Lucene_Search_QueryParserException('At least one range query boundary term must be non-empty term'); } $rangeQuery = new Zend_Search_Lucene_Search_Query_Range($from, $to, true); $entry = new Zend_Search_Lucene_Search_QueryEntry_Subquery($rangeQuery); $this->_context->addEntry($entry); }
/** * End subquery */ public function subqueryEnd() { if (count($this->_contextStack) == 0) { throw new Zend_Search_Lucene_Search_QueryParserException('Syntax Error: mismatched parentheses, every opening must have closing. Char position ' . $this->_currentToken->position . '.'); } $query = $this->_context->getQuery(); $this->_context = array_pop($this->_contextStack); $this->_context->addEntry(new Zend_Search_Lucene_Search_QueryEntry_Subquery($query)); }