git.iko.soy/typeable/bloodhound
on 2e332aa help sign in
bloodhound.cabal+3−3
since splitsnapshots
unifiedsplit
@@ -66,7 +66,7 @@ library
66 aeson >= 0.11.1,
66 aeson >= 0.11.1,
67 blaze-builder,
67 blaze-builder,
68 bytestring >= 0.10.0 && <0.11,
68 bytestring >= 0.10.0 && <0.11,
69− containers >= 0.5.0.0 && <0.6,
69+ containers >= 0.5.0.0 && <0.7,
70 exceptions,
70 exceptions,
71 hashable,
71 hashable,
72 http-client >= 0.4.30 && <0.7,
72 http-client >= 0.4.30 && <0.7,
@@ -74,10 +74,10 @@ library
74 mtl >= 1.0 && <2.3,
74 mtl >= 1.0 && <2.3,
75 network-uri >= 2.6 && <2.7,
75 network-uri >= 2.6 && <2.7,
76 scientific >= 0.3.0.0 && <0.4.0.0,
76 scientific >= 0.3.0.0 && <0.4.0.0,
77− semigroups >= 0.15 && <0.19,
77+ semigroups >= 0.15 && <0.20,
78 semver,
78 semver,
79 text >= 0.11 && <1.3,
79 text >= 0.11 && <1.3,
80− time >= 1.4 && <1.9,
80+ time >= 1.4 && <1.10,
81 transformers >= 0.2 && <0.6,
81 transformers >= 0.2 && <0.6,
82 unordered-containers,
82 unordered-containers,
83 vector >= 0.10.9 && <0.13
83 vector >= 0.10.9 && <0.13
src/Database/V1/Bloodhound/Internal/Query.hs+1−1
@@ -1468,7 +1468,7 @@ instance FromJSON ZeroTermsQuery where
1468 parse "all" = pure ZeroTermsAll
1468 parse "all" = pure ZeroTermsAll
1469 parse q = fail ("Unexpected ZeroTermsQuery: " <> show q)
1469 parse q = fail ("Unexpected ZeroTermsQuery: " <> show q)
1470
1470
1471−fieldTagged :: Monad m => (FieldName -> Object -> m a) -> Object -> m a
1471+fieldTagged :: (MonadFail m, Monad m) => (FieldName -> Object -> m a) -> Object -> m a
1472fieldTagged f o = case HM.toList o of
1472fieldTagged f o = case HM.toList o of
1473 [(k, Object o')] -> f (FieldName k) o'
1473 [(k, Object o')] -> f (FieldName k) o'
1474 _ -> fail "Expected object with 1 field-named key"
1474 _ -> fail "Expected object with 1 field-named key"
src/Database/V5/Bloodhound/Internal/Aggregation.hs+8
@@ -27,6 +27,7 @@ mkAggregations name aggregation = M.insert name aggregation emptyAggregations
27
27
28data Aggregation = TermsAgg TermsAggregation
28data Aggregation = TermsAgg TermsAggregation
29 | CardinalityAgg CardinalityAggregation
29 | CardinalityAgg CardinalityAggregation
30+ | MaxAgg MaxAggregation
30 | DateHistogramAgg DateHistogramAggregation
31 | DateHistogramAgg DateHistogramAggregation
31 | ValueCountAgg ValueCountAggregation
32 | ValueCountAgg ValueCountAggregation
32 | FilterAgg FilterAggregation
33 | FilterAgg FilterAggregation
@@ -58,6 +59,9 @@ instance ToJSON Aggregation where
58 ]
59 ]
59 ]
60 ]
60
61
62+ toJSON (MaxAgg (MaxAggregation field)) =
63+ object ["max" .= omitNulls [ "field" .= field ]]
64+
61 toJSON (DateHistogramAgg
65 toJSON (DateHistogramAgg
62 (DateHistogramAggregation field interval format
66 (DateHistogramAggregation field interval format
63 preZone postZone preOffset postOffset dateHistoAggs)) =
67 preZone postZone preOffset postOffset dateHistoAggs)) =
@@ -125,6 +129,10 @@ data CardinalityAggregation = CardinalityAggregation
125 precisionThreshold :: Maybe Int
129 precisionThreshold :: Maybe Int
126 } deriving (Eq, Show)
130 } deriving (Eq, Show)
127
131
132+data MaxAggregation = MaxAggregation
133+ { maxField :: FieldName
134+ } deriving (Eq, Show)
135+
128data DateHistogramAggregation = DateHistogramAggregation
136data DateHistogramAggregation = DateHistogramAggregation
129 { dateField :: FieldName
137 { dateField :: FieldName
130 , dateInterval :: Interval
138 , dateInterval :: Interval
src/Database/V5/Bloodhound/Internal/Analysis.hs−1
@@ -6,7 +6,6 @@ module Database.V5.Bloodhound.Internal.Analysis where
6import Bloodhound.Import
6import Bloodhound.Import
7
7
8import qualified Data.Map.Strict as M
8import qualified Data.Map.Strict as M
9−import Data.String
10import qualified Data.Text as T
9import qualified Data.Text as T
11
10
12import Database.V5.Bloodhound.Internal.Newtypes
11import Database.V5.Bloodhound.Internal.Newtypes
src/Database/V5/Bloodhound/Internal/Client.hs+11
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
1{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE FlexibleInstances #-}
2{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE MultiParamTypeClasses #-}
4{-# LANGUAGE MultiParamTypeClasses #-}
@@ -9,6 +10,11 @@ module Database.V5.Bloodhound.Internal.Client where
9
10
10import Bloodhound.Import
11import Bloodhound.Import
11
12
13+#if defined(MIN_VERSION_GLASGOW_HASKELL)
14+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
15+import Control.Monad.Fail (MonadFail)
16+#endif
17+#endif
12import qualified Data.Text as T
18import qualified Data.Text as T
13import qualified Data.Traversable as DT
19import qualified Data.Traversable as DT
14import qualified Data.HashMap.Strict as HM
20import qualified Data.HashMap.Strict as HM
@@ -71,6 +77,11 @@ newtype BH m a = BH {
71 , MonadFix
77 , MonadFix
72 , MonadThrow
78 , MonadThrow
73 , MonadCatch
79 , MonadCatch
80+#if defined(MIN_VERSION_GLASGOW_HASKELL)
81+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
82+ , MonadFail
83+#endif
84+#endif
74 , MonadMask)
85 , MonadMask)
75
86
76instance MonadTrans BH where
87instance MonadTrans BH where
src/Database/V5/Bloodhound/Types.hs+1
@@ -372,6 +372,7 @@ module Database.V5.Bloodhound.Types
372 , ValueCountAggregation(..)
372 , ValueCountAggregation(..)
373 , FilterAggregation(..)
373 , FilterAggregation(..)
374 , CardinalityAggregation(..)
374 , CardinalityAggregation(..)
375+ , MaxAggregation(..)
375 , DateHistogramAggregation(..)
376 , DateHistogramAggregation(..)
376 , DateRangeAggregation(..)
377 , DateRangeAggregation(..)
377 , DateRangeAggRange(..)
378 , DateRangeAggRange(..)
stack-8.6.yamlnew file+14
@@ -0,0 +1,14 @@
1+flags:
2+ bloodhound-examples:
3+ werror: true
4+
5+packages:
6+ - '.'
7+ - './examples'
8+
9+extra-deps:
10+ - git: https://github.com/bitemyapp/quickcheck-arbitrary-template.git
11+ commit: bf9cee96a88ecce2ff920ce74c166a38712e5ed2
12+ - quickcheck-properties-0.1
13+
14+resolver: lts-13.21
stack.yaml+1−1
@@ -1 +1 @@
1−stack-8.2.yaml
1+stack-8.6.yaml