git.iko.soy/typeable/bloodhound
on master help sign in
Merge pull request #40 from silkapp/boost-in-match-query
d87027dChris Allen
src/Database/Bloodhound/Client.hs+2−2
@@ -617,9 +617,9 @@ mkHighlightSearch query searchHighlights = Search query Nothing Nothing Nothing
617-- >>> let query = QueryMatchQuery $ mkMatchQuery (FieldName "_all") (QueryString "haskell")
617-- >>> let query = QueryMatchQuery $ mkMatchQuery (FieldName "_all") (QueryString "haskell")
618-- >>> let search = mkSearch (Just query) Nothing
618-- >>> let search = mkSearch (Just query) Nothing
619-- >>> search
619-- >>> search
620−-- Search {queryBody = Just (QueryMatchQuery (MatchQuery {matchQueryField = FieldName "_all", matchQueryQueryString = QueryString "haskell", matchQueryOperator = Or, matchQueryZeroTerms = ZeroTermsNone, matchQueryCutoffFrequency = Nothing, matchQueryMatchType = Nothing, matchQueryAnalyzer = Nothing, matchQueryMaxExpansions = Nothing, matchQueryLenient = Nothing})), filterBody = Nothing, sortBody = Nothing, aggBody = Nothing, highlight = Nothing, trackSortScores = False, from = From 0, size = Size 10, searchType = SearchTypeQueryThenFetch, fields = Nothing, source = Nothing}
620+-- Search {queryBody = Just (QueryMatchQuery (MatchQuery {matchQueryField = FieldName "_all", matchQueryQueryString = QueryString "haskell", matchQueryOperator = Or, matchQueryZeroTerms = ZeroTermsNone, matchQueryCutoffFrequency = Nothing, matchQueryMatchType = Nothing, matchQueryAnalyzer = Nothing, matchQueryMaxExpansions = Nothing, matchQueryLenient = Nothing, matchQueryBoost = Nothing})), filterBody = Nothing, sortBody = Nothing, aggBody = Nothing, highlight = Nothing, trackSortScores = False, from = From 0, size = Size 10, searchType = SearchTypeQueryThenFetch, fields = Nothing, source = Nothing}
621-- >>> pageSearch (From 10) (Size 100) search
621-- >>> pageSearch (From 10) (Size 100) search
622−-- Search {queryBody = Just (QueryMatchQuery (MatchQuery {matchQueryField = FieldName "_all", matchQueryQueryString = QueryString "haskell", matchQueryOperator = Or, matchQueryZeroTerms = ZeroTermsNone, matchQueryCutoffFrequency = Nothing, matchQueryMatchType = Nothing, matchQueryAnalyzer = Nothing, matchQueryMaxExpansions = Nothing, matchQueryLenient = Nothing})), filterBody = Nothing, sortBody = Nothing, aggBody = Nothing, highlight = Nothing, trackSortScores = False, from = From 10, size = Size 100, searchType = SearchTypeQueryThenFetch, fields = Nothing, source = Nothing}
622+-- Search {queryBody = Just (QueryMatchQuery (MatchQuery {matchQueryField = FieldName "_all", matchQueryQueryString = QueryString "haskell", matchQueryOperator = Or, matchQueryZeroTerms = ZeroTermsNone, matchQueryCutoffFrequency = Nothing, matchQueryMatchType = Nothing, matchQueryAnalyzer = Nothing, matchQueryMaxExpansions = Nothing, matchQueryLenient = Nothing, matchQueryBoost = Nothing})), filterBody = Nothing, sortBody = Nothing, aggBody = Nothing, highlight = Nothing, trackSortScores = False, from = From 10, size = Size 100, searchType = SearchTypeQueryThenFetch, fields = Nothing, source = Nothing}
623pageSearch :: From -- ^ The result offset
623pageSearch :: From -- ^ The result offset
624 -> Size -- ^ The number of results to return
624 -> Size -- ^ The number of results to return
625 -> Search -- ^ The current seach
625 -> Search -- ^ The current seach
src/Database/Bloodhound/Types.hs+6−4
@@ -1051,13 +1051,14 @@ data MatchQuery =
1051 , matchQueryMatchType :: Maybe MatchQueryType
1051 , matchQueryMatchType :: Maybe MatchQueryType
1052 , matchQueryAnalyzer :: Maybe Analyzer
1052 , matchQueryAnalyzer :: Maybe Analyzer
1053 , matchQueryMaxExpansions :: Maybe MaxExpansions
1053 , matchQueryMaxExpansions :: Maybe MaxExpansions
1054− , matchQueryLenient :: Maybe Lenient } deriving (Eq, Show)
1054+ , matchQueryLenient :: Maybe Lenient
1055+ , matchQueryBoost :: Maybe Boost } deriving (Eq, Show)
1055
1056
1056{-| 'mkMatchQuery' is a convenience function that defaults the less common parameters,
1057{-| 'mkMatchQuery' is a convenience function that defaults the less common parameters,
1057 enabling you to provide only the 'FieldName' and 'QueryString' to make a 'MatchQuery'
1058 enabling you to provide only the 'FieldName' and 'QueryString' to make a 'MatchQuery'
1058-}
1059-}
1059mkMatchQuery :: FieldName -> QueryString -> MatchQuery
1060mkMatchQuery :: FieldName -> QueryString -> MatchQuery
1060−mkMatchQuery field query = MatchQuery field query Or ZeroTermsNone Nothing Nothing Nothing Nothing Nothing
1061+mkMatchQuery field query = MatchQuery field query Or ZeroTermsNone Nothing Nothing Nothing Nothing Nothing Nothing
1061
1062
1062data MatchQueryType =
1063data MatchQueryType =
1063 MatchPhrase
1064 MatchPhrase
@@ -1987,7 +1988,7 @@ instance ToJSON MatchQuery where
1987 toJSON (MatchQuery (FieldName fieldName)
1988 toJSON (MatchQuery (FieldName fieldName)
1988 (QueryString mqQueryString) booleanOperator
1989 (QueryString mqQueryString) booleanOperator
1989 zeroTermsQuery cutoffFrequency matchQueryType
1990 zeroTermsQuery cutoffFrequency matchQueryType
1990− analyzer maxExpansions lenient) =
1991+ analyzer maxExpansions lenient boost) =
1991 object [ fieldName .= omitNulls base ]
1992 object [ fieldName .= omitNulls base ]
1992 where base = [ "query" .= mqQueryString
1993 where base = [ "query" .= mqQueryString
1993 , "operator" .= booleanOperator
1994 , "operator" .= booleanOperator
@@ -1996,7 +1997,8 @@ instance ToJSON MatchQuery where
1996 , "type" .= matchQueryType
1997 , "type" .= matchQueryType
1997 , "analyzer" .= analyzer
1998 , "analyzer" .= analyzer
1998 , "max_expansions" .= maxExpansions
1999 , "max_expansions" .= maxExpansions
1999− , "lenient" .= lenient ]
2000+ , "lenient" .= lenient
2001+ , "boost" .= boost ]
2000
2002
2001
2003
2002instance ToJSON MultiMatchQuery where
2004instance ToJSON MultiMatchQuery where