From 5ebc7dfc7c2452a3660cf57cdabc6332745ba563 Mon Sep 17 00:00:00 2001 From: Alasdair Date: Wed, 21 Feb 2018 16:23:51 +0000 Subject: [PATCH] feat: ability to add fuzziness --- src/DesignMyNight/Elasticsearch/QueryGrammar.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/DesignMyNight/Elasticsearch/QueryGrammar.php b/src/DesignMyNight/Elasticsearch/QueryGrammar.php index 73d7240..e70c16a 100644 --- a/src/DesignMyNight/Elasticsearch/QueryGrammar.php +++ b/src/DesignMyNight/Elasticsearch/QueryGrammar.php @@ -390,6 +390,11 @@ protected function compileWhereSearch($builder, $where) ]; } + if (!empty($where['options']['fuzziness'])) { + $firstKey = array_keys($query)[0]; + $query[$firstKey]['fuzziness'] = (int) $where['options']['fuzziness']; + } + return $query; }