Example #1
0
 /**
  * @return string
  */
 public function getQuery()
 {
     if ($this->customQuery) {
         parent::setQuery($this->customQuery);
         return $this->customQuery;
     }
     $term = '';
     if (count($this->searchTerms) == 0) {
         $query = '*:*';
         parent::setQuery($query);
         return $query;
     }
     $logicOperator = 'AND';
     if (!$this->useAndOperator) {
         $logicOperator = 'OR';
     }
     $termCount = 1;
     foreach ($this->searchTerms as $fieldName => $fieldValue) {
         $fieldValue = $this->querifyFieldValue($fieldValue);
         $term .= $fieldName . ':' . $fieldValue;
         if ($termCount < count($this->searchTerms)) {
             $term .= ' ' . $logicOperator . ' ';
         }
         $termCount++;
     }
     $this->setQuery($term);
     return $term;
 }