Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * Process logical operator
  */
 public function logicalOperator()
 {
     $this->_context->addLogicalOperator($this->_currentToken->type);
 }