git.iko.soy/typeable/bloodhound
on 2e332aa help sign in
8 files changed+39−6
since splitsnapshots
unifiedsplit
bloodhound.cabal+3−3 src/Database/V1/Bloodhound/Internal/Query.hs+1−1 src/Database/V5/Bloodhound/Internal/Aggregation.hs+8 src/Database/V5/Bloodhound/Internal/Analysis.hs−1 src/Database/V5/Bloodhound/Internal/Client.hs+11 src/Database/V5/Bloodhound/Types.hs+1 stack-8.6.yaml+14 stack.yaml+1−1
bloodhound.cabal+3−3
@@ -66,7 +66,7 @@ library
6666 aeson >= 0.11.1,
6767 blaze-builder,
6868 bytestring >= 0.10.0 && <0.11,
69− containers >= 0.5.0.0 && <0.6,
69+ containers >= 0.5.0.0 && <0.7,
7070 exceptions,
7171 hashable,
7272 http-client >= 0.4.30 && <0.7,
@@ -74,10 +74,10 @@ library
7474 mtl >= 1.0 && <2.3,
7575 network-uri >= 2.6 && <2.7,
7676 scientific >= 0.3.0.0 && <0.4.0.0,
77− semigroups >= 0.15 && <0.19,
77+ semigroups >= 0.15 && <0.20,
7878 semver,
7979 text >= 0.11 && <1.3,
80− time >= 1.4 && <1.9,
80+ time >= 1.4 && <1.10,
8181 transformers >= 0.2 && <0.6,
8282 unordered-containers,
8383 vector >= 0.10.9 && <0.13
src/Database/V1/Bloodhound/Internal/Query.hs+1−1
@@ -1468,7 +1468,7 @@ instance FromJSON ZeroTermsQuery where
14681468 parse "all" = pure ZeroTermsAll
14691469 parse q = fail ("Unexpected ZeroTermsQuery: " <> show q)
14701470
1471−fieldTagged :: Monad m => (FieldName -> Object -> m a) -> Object -> m a
1471+fieldTagged :: (MonadFail m, Monad m) => (FieldName -> Object -> m a) -> Object -> m a
14721472fieldTagged f o = case HM.toList o of
14731473 [(k, Object o')] -> f (FieldName k) o'
14741474 _ -> 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
2727
2828data Aggregation = TermsAgg TermsAggregation
2929 | CardinalityAgg CardinalityAggregation
30+ | MaxAgg MaxAggregation
3031 | DateHistogramAgg DateHistogramAggregation
3132 | ValueCountAgg ValueCountAggregation
3233 | FilterAgg FilterAggregation
@@ -58,6 +59,9 @@ instance ToJSON Aggregation where
5859 ]
5960 ]
6061
62+ toJSON (MaxAgg (MaxAggregation field)) =
63+ object ["max" .= omitNulls [ "field" .= field ]]
64+
6165 toJSON (DateHistogramAgg
6266 (DateHistogramAggregation field interval format
6367 preZone postZone preOffset postOffset dateHistoAggs)) =
@@ -125,6 +129,10 @@ data CardinalityAggregation = CardinalityAggregation
125129 precisionThreshold :: Maybe Int
126130 } deriving (Eq, Show)
127131
132+data MaxAggregation = MaxAggregation
133+ { maxField :: FieldName
134+ } deriving (Eq, Show)
135+
128136data DateHistogramAggregation = DateHistogramAggregation
129137 { dateField :: FieldName
130138 , dateInterval :: Interval
src/Database/V5/Bloodhound/Internal/Analysis.hs−1
@@ -6,7 +6,6 @@ module Database.V5.Bloodhound.Internal.Analysis where
66import Bloodhound.Import
77
88import qualified Data.Map.Strict as M
9−import Data.String
109import qualified Data.Text as T
1110
1211import Database.V5.Bloodhound.Internal.Newtypes
src/Database/V5/Bloodhound/Internal/Client.hs+11
@@ -1,3 +1,4 @@
1+{-# LANGUAGE CPP #-}
12{-# LANGUAGE FlexibleInstances #-}
23{-# LANGUAGE GeneralizedNewtypeDeriving #-}
34{-# LANGUAGE MultiParamTypeClasses #-}
@@ -9,6 +10,11 @@ module Database.V5.Bloodhound.Internal.Client where
910
1011import Bloodhound.Import
1112
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
1218import qualified Data.Text as T
1319import qualified Data.Traversable as DT
1420import qualified Data.HashMap.Strict as HM
@@ -71,6 +77,11 @@ newtype BH m a = BH {
7177 , MonadFix
7278 , MonadThrow
7379 , MonadCatch
80+#if defined(MIN_VERSION_GLASGOW_HASKELL)
81+#if MIN_VERSION_GLASGOW_HASKELL(8,6,0,0)
82+ , MonadFail
83+#endif
84+#endif
7485 , MonadMask)
7586
7687instance MonadTrans BH where
src/Database/V5/Bloodhound/Types.hs+1
@@ -372,6 +372,7 @@ module Database.V5.Bloodhound.Types
372372 , ValueCountAggregation(..)
373373 , FilterAggregation(..)
374374 , CardinalityAggregation(..)
375+ , MaxAggregation(..)
375376 , DateHistogramAggregation(..)
376377 , DateRangeAggregation(..)
377378 , 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