protected function buildMatchExpression($field_name, $criteria_value)
 {
     $matches = array();
     $expr = parent::buildMatchExpression($field_name, $criteria_value);
     if (!$expr) {
         // else transform into a series of LIKE %word%
         if (is_array($criteria_value)) {
             $split = preg_split('/\\s+/', $criteria_value['value']);
         } else {
             $split = preg_split('/\\s+/', $criteria_value);
         }
         $words = array();
         foreach ($split as $w) {
             $words[] = $field_name . " LIKE " . $this->quote('%' . $w . '%');
         }
         $expr = join(' AND ', $words);
     }
     return $expr;
 }
 protected function buildMatchExpression($field_name, $criteria_value)
 {
     $expr = parent::buildMatchExpression($field_name, $criteria_value);
     if (!$expr) {
         $matches = array();
         if (preg_match("/^(<|>|>=|<=)\\s*({$this->pattern})\$/", $criteria_value, $matches)) {
             // It's < or >,  = and a number then use as is
             $matches[2] = (string) $this->cast($matches[2]);
             $expr = $field_name . ' ' . $matches[1] . ' ' . $matches[2];
         } else {
             if (preg_match("/^({$this->pattern})\$/", $criteria_value, $matches)) {
                 // It's a number so use  equality
                 $matches[1] = $this->cast($matches[1]);
                 $expr = $field_name . ' = ' . $matches[1];
             } else {
                 if (preg_match("/^({$this->pattern})\\s*-\\s*({$this->pattern})\$/", $criteria_value, $matches)) {
                     // it's a range number1-number2
                     $matches[1] = (string) $this->cast($matches[1]);
                     $matches[2] = (string) $this->cast($matches[2]);
                     $expr = $field_name . ' >= ' . $matches[1] . ' AND ' . $field_name . ' <= ' . $matches[2];
                 } else {
                     // Invalid syntax - no condition
                     $expr = '1';
                 }
             }
         }
     }
     return $expr;
 }