mirror of
https://github.com/typeable/bloodhound.git
synced 2024-09-11 08:25:32 +03:00
Added Fuzziness to MatchQuery
This commit is contained in:
parent
c71a130f1f
commit
4e61602b3f
@ -845,6 +845,7 @@ data MatchQuery = MatchQuery
|
|||||||
, matchQueryLenient :: Maybe Lenient
|
, matchQueryLenient :: Maybe Lenient
|
||||||
, matchQueryBoost :: Maybe Boost
|
, matchQueryBoost :: Maybe Boost
|
||||||
, matchQueryMinimumShouldMatch :: Maybe Text
|
, matchQueryMinimumShouldMatch :: Maybe Text
|
||||||
|
, matchQueryFuzziness :: Maybe Fuzziness
|
||||||
} deriving (Eq, Show)
|
} deriving (Eq, Show)
|
||||||
|
|
||||||
|
|
||||||
@ -853,7 +854,7 @@ instance ToJSON MatchQuery where
|
|||||||
(QueryString mqQueryString) booleanOperator
|
(QueryString mqQueryString) booleanOperator
|
||||||
zeroTermsQuery cutoffFrequency matchQueryType
|
zeroTermsQuery cutoffFrequency matchQueryType
|
||||||
analyzer maxExpansions lenient boost
|
analyzer maxExpansions lenient boost
|
||||||
minShouldMatch
|
minShouldMatch mqFuzziness
|
||||||
) =
|
) =
|
||||||
object [ fieldName .= omitNulls base ]
|
object [ fieldName .= omitNulls base ]
|
||||||
where base = [ "query" .= mqQueryString
|
where base = [ "query" .= mqQueryString
|
||||||
@ -866,6 +867,7 @@ instance ToJSON MatchQuery where
|
|||||||
, "lenient" .= lenient
|
, "lenient" .= lenient
|
||||||
, "boost" .= boost
|
, "boost" .= boost
|
||||||
, "minimum_should_match" .= minShouldMatch
|
, "minimum_should_match" .= minShouldMatch
|
||||||
|
, "fuzziness" .= mqFuzziness
|
||||||
]
|
]
|
||||||
|
|
||||||
instance FromJSON MatchQuery where
|
instance FromJSON MatchQuery where
|
||||||
@ -882,12 +884,13 @@ instance FromJSON MatchQuery where
|
|||||||
<*> o .:? "lenient"
|
<*> o .:? "lenient"
|
||||||
<*> o .:? "boost"
|
<*> o .:? "boost"
|
||||||
<*> o .:? "minimum_should_match"
|
<*> o .:? "minimum_should_match"
|
||||||
|
<*> o .:? "fuzziness"
|
||||||
|
|
||||||
{-| 'mkMatchQuery' is a convenience function that defaults the less common parameters,
|
{-| 'mkMatchQuery' is a convenience function that defaults the less common parameters,
|
||||||
enabling you to provide only the 'FieldName' and 'QueryString' to make a 'MatchQuery'
|
enabling you to provide only the 'FieldName' and 'QueryString' to make a 'MatchQuery'
|
||||||
-}
|
-}
|
||||||
mkMatchQuery :: FieldName -> QueryString -> MatchQuery
|
mkMatchQuery :: FieldName -> QueryString -> MatchQuery
|
||||||
mkMatchQuery field query = MatchQuery field query Or ZeroTermsNone Nothing Nothing Nothing Nothing Nothing Nothing Nothing
|
mkMatchQuery field query = MatchQuery field query Or ZeroTermsNone Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
|
||||||
|
|
||||||
data MatchQueryType =
|
data MatchQueryType =
|
||||||
MatchPhrase
|
MatchPhrase
|
||||||
|
Loading…
Reference in New Issue
Block a user