Exemplo n.º 1
0
 /**
  * fuzzy condition builder for nested documents
  *
  * @param $column
  * @param $value
  * @param float $boost
  * @param integer|string $fuzziness
  * @return array|bool
  */
 public static function nestedFuzzy($column, $value, $boost = null, $fuzziness = 'auto')
 {
     $matches = [];
     preg_match('#^(.*)\\.(\\w+)$#', $column, $matches);
     $cnt = count($matches);
     if (in_array($matches[$cnt - 1], self::$raw_cols)) {
         $matches[$cnt - 2] = $matches[$cnt - 2] . $matches[$cnt - 1];
         unset($matches[$cnt - 1]);
     }
     self::$is_nested_prepared = true;
     return ['nested' => ['path' => $matches[1], 'query' => self::fuzzy($column, $value, $boost, $fuzziness)]];
 }