Exemple #1
0
 protected function _doInverse(IExpression $expression)
 {
     if ($expression instanceof Not) {
         return $expression->getExpression();
     }
     return new Not($expression);
 }
Exemple #2
0
 protected function createFilterQuery(Query $query)
 {
     if ($this->expression === NULL) {
         return NULL;
     }
     $this->expression = $this->doInverse($this->expression);
     if (($queryString = $this->expression->build()) !== NULL) {
         $key = $this->key ?: md5($queryString);
         $fq = $query->createFilterQuery($key)->setQuery($queryString);
         if ($this->expression instanceof FieldExpression) {
             $fq->addTag($this->expression->getField());
         }
         if ($this->key !== NULL) {
             $fq->addTag($this->key);
         }
     } else {
         $fq = NULL;
     }
     $this->expression = $this->doInverse($this->expression);
     //return to original state
     return $fq;
 }
 /**
  * @return string
  */
 public function build()
 {
     return sprintf('%s:(%s)', $this->field, $this->expression->build());
 }
Exemple #4
0
 /**
  * @return string
  */
 public function build()
 {
     return 'NOT(' . $this->expression->build() . ')';
 }
Exemple #5
0
 public function match(Query $query)
 {
     if ($this->expression && ($queryString = $this->expression->build()) !== NULL) {
         $query->setQuery($queryString);
     }
 }