packages feed

bloodhound 0.21.0.0 → 0.22.0.0

raw patch · 7 files changed

+103/−7 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Database.Bloodhound.Types: omitField :: ToJSON a => a -> Bool
- Database.Bloodhound.Types: EsError :: Int -> Text -> EsError
+ Database.Bloodhound.Types: EsError :: Maybe Int -> Text -> EsError
- Database.Bloodhound.Types: [errorStatus] :: EsError -> Int
+ Database.Bloodhound.Types: [errorStatus] :: EsError -> Maybe Int
- Database.Bloodhound.Types: class ToJSON a
+ Database.Bloodhound.Types: class () => ToJSON a

Files

bloodhound.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.7.+-- This file has been generated from package.yaml by hpack version 0.36.1. -- -- see: https://github.com/sol/hpack  name:           bloodhound-version:        0.21.0.0+version:        0.22.0.0 synopsis:       Elasticsearch client library for Haskell description:    Elasticsearch made awesome for Haskell hackers category:       Database, Search@@ -47,6 +47,7 @@       Database.Bloodhound.Internal.Client.Doc       Database.Bloodhound.Internal.Count       Database.Bloodhound.Internal.PointInTime+      X       Paths_bloodhound   hs-source-dirs:       src
changelog.md view
@@ -1,3 +1,8 @@+0.22.0.0+========+- @blackheaven+  - Fix `EsError` for OpenSearch+ 0.21.0.0 ======== - @blackheaven
src/Database/Bloodhound/Internal/Client/BHRequest.hs view
@@ -261,7 +261,7 @@ --    problem. If you can't parse the expected response, its a good idea to --    try parsing this. data EsError = EsError-  { errorStatus :: Int,+  { errorStatus :: Maybe Int,     errorMessage :: Text   }   deriving (Eq, Show)@@ -269,7 +269,7 @@ instance FromJSON EsError where   parseJSON (Object v) =     EsError-      <$> v .: "status"+      <$> v .:? "status"       <*> (v .: "error" <|> (v .: "error" >>= (.: "reason")))   parseJSON _ = empty 
+ src/X.hs view
@@ -0,0 +1,90 @@+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE TypeApplications #-}++module X where++import Control.Monad (forM_)+import qualified Data.Map.Strict as Map+import qualified Data.Set as Set+import GHC.Generics++-- type family X :: k0 -> '[k1] where+--   X V1 = '[]+--   X U1 = '[]+--   X (Par1 p) = '[]+--   X (Rec1 p) = '[]+--   X (K1 R c) = '[c]+--   X (K1 i c) = X c+--   X (M1 i c f) = X f+--   X (f :+: g) =++main :: IO ()+main = do+  let depsOf x = Map.findWithDefault mempty x direct+      transitiveDependencies :: String -> Set.Set String+      transitiveDependencies x = go (Set.singleton x) mempty+      go :: Set.Set String -> Set.Set String -> Set.Set String+      go queue walked =+        case Set.maxView queue of+          Nothing ->+            walked+          Just (x, xs)+            | Set.member x walked -> go xs walked+          Just (x, xs) ->+            go (depsOf x `Set.union` xs) (Set.insert x walked)+      queryDeps :: Map.Map String (Set.Set String)+      queryDeps = Map.fromSet transitiveDependencies $ depsOf "Query"+      queryNoRecDeps :: Map.Map String (Set.Set String)+      queryNoRecDeps = Map.filter (not . Set.member "Query") queryDeps+      countDeps = Set.size . Set.unions . Map.elems+      commons = Set.unions [Set.intersection xs ys | (x, xs) <- Map.toList queryNoRecDeps, (y, ys) <- Map.toList queryNoRecDeps, x /= y]+      queryNoRecDepsNoCommons = Map.filter (not . Set.null) $ (Set.\\ commons) <$> queryNoRecDeps+      dropQuery s =+        case s of+          "" -> ""+          "Query" -> ""+          (x : xs) -> x : dropQuery xs++  forM_ (Map.toList queryNoRecDepsNoCommons) $ \(k, ds) -> putStrLn $ k <> " -> " <> show (Set.toList ds)+  print ("total", countDeps queryDeps)+  print ("extractable", countDeps queryNoRecDeps)+  print ("commons", Set.size commons, Set.toList commons)++-- forM_ (Map.toList queryNoRecDepsNoCommons) $ \(k, ds) -> putStrLn $ "Database.Bloodhound.Internal.Versions.Common.Types.Query." <> dropQuery k++direct :: Map.Map String (Set.Set String)+direct =+  Map.fromList+    [ ("Query", Set.fromList ["Term", "MatchQuery", "MultiMatchQuery", "BoolQuery", "BoostingQuery", "CommonTermsQuery", "Query", "Boost", "FunctionScoreQuery", "DisMaxQuery", "FuzzyLikeThisQuery", "FuzzyLikeFieldQuery", "FuzzyQuery", "HasChildQuery", "HasParentQuery", "IndicesQuery", "MoreLikeThisQuery", "MoreLikeThisFieldQuery", "NestedQuery", "PrefixQuery", "QueryStringQuery", "SimpleQueryStringQuery", "RangeQuery", "RegexpQuery", "WildcardQuery"]),+      ("MatchQuery", Set.fromList ["QueryString", "BooleanOperator", "ZeroTermsQuery", "CutoffFrequency", "MatchQueryType", "Analyzer", "MaxExpansions", "Lenient", "Boost", "Fuzziness"]),+      ("MultiMatchQuery", Set.fromList ["QueryString", "BooleanOperator", "ZeroTermsQuery", "Tiebreaker", "MultiMatchQueryType", "CutoffFrequency", "Analyzer", "MaxExpansions", "Lenient"]),+      ("BoolQuery", Set.fromList ["Query", "Filter", "MinimumMatch", "Boost", "DisableCoord"]),+      ("BoostingQuery", Set.fromList ["Boost", "Query"]),+      ("CommonTermsQuery", Set.fromList ["QueryString", "CutoffFrequency", "BooleanOperator", "BooleanOperator", "CommonMinimumMatch", "Boost", "Analyzer", "DisableCoord"]),+      ("FunctionScoreQuery", Set.fromList ["FunctionScoreFunctions", "Query", "Boost", "Boost", "BoostMode", "Double", "ScoreMode"]),+      ("DisMaxQuery", Set.fromList ["Boost", "Tiebreaker", "Query"]),+      ("FuzzyLikeThisQuery", Set.fromList ["MaxQueryTerms", "IgnoreTermFrequency", "Fuzziness", "PrefixLength", "Boost", "Analyzer"]),+      ("FuzzyLikeFieldQuery", Set.fromList ["MaxQueryTerms", "IgnoreTermFrequency", "Fuzziness", "PrefixLength", "Boost", "Analyzer"]),+      ("FuzzyQuery", Set.fromList ["PrefixLength", "MaxExpansions", "Fuzziness", "Boost"]),+      ("HasChildQuery", Set.fromList ["RelationName", "Query", "ScoreType", "IgnoreUnmapped", "MinChildren", "MaxChildren"]),+      ("HasParentQuery", Set.fromList ["RelationName", "Query", "AggregateParentScore", "IgnoreUnmapped"]),+      ("IndicesQuery", Set.fromList ["Query", "IndexName"]),+      ("MoreLikeThisQuery", Set.fromList ["PercentMatch", "MinimumTermFrequency", "MaxQueryTerms", "StopWord", "MinDocFrequency", "MaxDocFrequency", "MinWordLength", "MaxWordLength", "BoostTerms", "Boost", "Analyzer"]),+      ("MoreLikeThisFieldQuery", Set.fromList ["PercentMatch", "MinimumTermFrequency", "MaxQueryTerms", "StopWord", "MinDocFrequency", "MaxDocFrequency", "MinWordLength", "MaxWordLength", "BoostTerms", "Boost", "Analyzer"]),+      ("NestedQuery", Set.fromList ["QueryPath", "ScoreType", "Query", "InnerHits"]),+      ("PrefixQuery", Set.fromList ["Boost"]),+      ("QueryStringQuery", Set.fromList ["QueryString", "BooleanOperator", "Analyzer", "AllowLeadingWildcard", "LowercaseExpanded", "EnablePositionIncrements", "MaxExpansions", "Fuzziness", "PrefixLength", "PhraseSlop", "Boost", "AnalyzeWildcard", "GeneratePhraseQueries", "MinimumMatch", "Lenient", "Locale"]),+      ("SimpleQueryStringQuery", Set.fromList ["QueryString", "FieldOrFields", "BooleanOperator", "Analyzer", "SimpleQueryFlag", "LowercaseExpanded", "Locale"]),+      ("RangeQuery", Set.fromList ["RangeValue", "Boost"]),+      ("RegexpQuery", Set.fromList ["Regexp", "RegexpFlags", "Boost"]),+      ("WildcardQuery", Set.fromList ["Boost"]),+      ("CommonMinimumMatch", Set.fromList ["MinimumMatchHighLow", "MinimumMatch"]),+      ("Filter", Set.fromList ["Query"]),+      ("FunctionScoreFunctions", Set.fromList ["FunctionScoreFunction", "ComponentFunctionScoreFunction"]),+      ("FunctionScoreFunction", Set.fromList ["Script", "Seed", "FieldValueFactor"]),+      ("RangeValue", Set.fromList ["LessThanEqD", "LessThanD", "GreaterThanEqD", "GreaterThanD", "LessThanEq", "LessThan", "GreaterThanEq", "GreaterThan"]),+      ("MinimumMatchHighLow", Set.fromList ["MinimumMatch"]),+      ("FieldValueFactor", Set.fromList ["Factor", "FactorModifier", "FactorMissingFieldValue"]),+      ("ComponentFunctionScoreFunction", Set.fromList ["Filter", "FunctionScoreFunction", "Weight"])+    ]
tests/Test/Import.hs view
@@ -46,7 +46,7 @@ grabFirst r =   case fmap (hitSource . head . hits . searchHits) r of     (Left e) -> Left e-    (Right Nothing) -> Left (EsError 500 "Source was missing")+    (Right Nothing) -> Left (EsError (Just 500) "Source was missing")     (Right (Just x)) -> Right x  when' :: Monad m => m Bool -> m () -> m ()
tests/Test/SourceFiltering.hs view
@@ -13,7 +13,7 @@       withTestEnv $         searchExpectSource           NoSource-          (Left (EsError 500 "Source was missing"))+          (Left (EsError (Just 500) "Source was missing"))      it "includes a source" $       withTestEnv $
tests/tests.hs view
@@ -52,7 +52,7 @@       withTestEnv $ do         res <- getDocument @() (IndexName "bogus") (DocId "bogus_as_well")         errorResp <- parseEsResponse res-        liftIO (errorResp `shouldBe` Left (EsError 404 "no such index [bogus]"))+        liftIO (errorResp `shouldBe` Left (EsError (Just 404) "no such index [bogus]"))    describe "Monoid (SearchHits a)" $     prop "abides the monoid laws" $