Please support "minimum_should_match" in match query
dawei-dev opened this issue · 3 comments
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-match-query.html
The match query is of type boolean. It means that the text provided is analyzed and the analysis process constructs a boolean query from the provided text. The operator flag can be set to or or and to control the boolean clauses (defaults to or). The minimum number of optional should clauses to match can be set using the minimum_should_match parameter.
Today the MatchQuery is:
data MatchQuery =
MatchQuery { matchQueryField :: FieldName
, matchQueryQueryString :: QueryString
, matchQueryOperator :: BooleanOperator
, matchQueryZeroTerms :: ZeroTermsQuery
, matchQueryCutoffFrequency :: Maybe CutoffFrequency
, matchQueryMatchType :: Maybe MatchQueryType
, matchQueryAnalyzer :: Maybe Analyzer
, matchQueryMaxExpansions :: Maybe MaxExpansions
, matchQueryLenient :: Maybe Lenient
, matchQueryBoost :: Maybe Boost } deriving (Eq, Read, Show, Generic, Typeable)
which doesn't support this.
I can use Bool query, but it doesn't suits my use case.
I took a gander, we implement minimum_should_match
in a couple places, just not in match query. You should be able to add it to MatchQuery
in V1
and V5
and PR it.
Let me know if you need help with this.
My commit failed to pass the Travis test.
I haven't modified anything in the original test folder. Should I?
I have tested my modified version in an example project and it seems to work.
I think this is resolved now: https://github.com/bitemyapp/bloodhound/blob/master/src/Database/Bloodhound/Internal/Query.hs#L847
Please let me know if I'm wrong.