git.iko.soy/typeable/bloodhound
on master help sign in
Everybody gets a Typeable!
0137a8eMichael Xavier
src/Database/Bloodhound/Types.hs+94−92
@@ -1,3 +1,4 @@
1+{-# LANGUAGE DeriveDataTypeable #-}
1{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleContexts #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE FlexibleInstances #-}
@@ -262,6 +263,7 @@ import Data.Text (Text)
262import qualified Data.Text as T
263import qualified Data.Text as T
263import Data.Time.Clock (UTCTime)
264import Data.Time.Clock (UTCTime)
264import qualified Data.Traversable as DT
265import qualified Data.Traversable as DT
266+import Data.Typeable (Typeable)
265import qualified Data.Vector as V
267import qualified Data.Vector as V
266import GHC.Enum
268import GHC.Enum
267import GHC.Generics (Generic)
269import GHC.Generics (Generic)
@@ -335,7 +337,7 @@ data Version = Version { number :: Text
335 , build_hash :: Text
337 , build_hash :: Text
336 , build_timestamp :: UTCTime
338 , build_timestamp :: UTCTime
337 , build_snapshot :: Bool
339 , build_snapshot :: Bool
338− , lucene_version :: Text } deriving (Eq, Show, Generic)
340+ , lucene_version :: Text } deriving (Eq, Show, Generic, Typeable)
339
341
340{-| 'Status' is a data type for describing the JSON body returned by
342{-| 'Status' is a data type for describing the JSON body returned by
341 Elasticsearch when you query its status. This was deprecated in 1.2.0.
343 Elasticsearch when you query its status. This was deprecated in 1.2.0.
@@ -451,23 +453,23 @@ data IndexAlias = IndexAlias { srcIndex :: IndexName
451newtype IndexAliasName = IndexAliasName { indexAliasName :: IndexName } deriving (Eq, Show, ToJSON)
453newtype IndexAliasName = IndexAliasName { indexAliasName :: IndexName } deriving (Eq, Show, ToJSON)
452
454
453data IndexAliasAction = AddAlias IndexAlias IndexAliasCreate
455data IndexAliasAction = AddAlias IndexAlias IndexAliasCreate
454− | RemoveAlias IndexAlias deriving (Show, Eq)
456+ | RemoveAlias IndexAlias deriving (Show, Eq, Typeable)
455
457
456data IndexAliasCreate = IndexAliasCreate { aliasCreateRouting :: Maybe AliasRouting
458data IndexAliasCreate = IndexAliasCreate { aliasCreateRouting :: Maybe AliasRouting
457 , aliasCreateFilter :: Maybe Filter}
459 , aliasCreateFilter :: Maybe Filter}
458− deriving (Show, Eq)
460+ deriving (Show, Eq, Typeable)
459
461
460data AliasRouting = AllAliasRouting RoutingValue
462data AliasRouting = AllAliasRouting RoutingValue
461 | GranularAliasRouting (Maybe SearchAliasRouting) (Maybe IndexAliasRouting)
463 | GranularAliasRouting (Maybe SearchAliasRouting) (Maybe IndexAliasRouting)
462− deriving (Show, Eq)
464+ deriving (Show, Eq, Typeable)
463
465
464−newtype SearchAliasRouting = SearchAliasRouting (NonEmpty RoutingValue) deriving (Show, Eq)
466+newtype SearchAliasRouting = SearchAliasRouting (NonEmpty RoutingValue) deriving (Show, Eq, Typeable)
465
467
466−newtype IndexAliasRouting = IndexAliasRouting RoutingValue deriving (Show, Eq, ToJSON, FromJSON)
468+newtype IndexAliasRouting = IndexAliasRouting RoutingValue deriving (Show, Eq, ToJSON, FromJSON, Typeable)
467
469
468−newtype RoutingValue = RoutingValue { routingValue :: Text } deriving (Show, Eq, ToJSON, FromJSON)
470+newtype RoutingValue = RoutingValue { routingValue :: Text } deriving (Show, Eq, ToJSON, FromJSON, Typeable)
469
471
470−newtype IndexAliasesSummary = IndexAliasesSummary { indexAliasesSummary :: [IndexAliasSummary] } deriving (Show, Eq)
472+newtype IndexAliasesSummary = IndexAliasesSummary { indexAliasesSummary :: [IndexAliasSummary] } deriving (Show, Eq, Typeable)
471
473
472{-| 'IndexAliasSummary' is a summary of an index alias configured for a server. -}
474{-| 'IndexAliasSummary' is a summary of an index alias configured for a server. -}
473data IndexAliasSummary = IndexAliasSummary { indexAliasSummaryAlias :: IndexAlias
475data IndexAliasSummary = IndexAliasSummary { indexAliasSummaryAlias :: IndexAlias
@@ -623,15 +625,15 @@ type PrefixValue = Text
623{-| 'BooleanOperator' is the usual And/Or operators with an ES compatible
625{-| 'BooleanOperator' is the usual And/Or operators with an ES compatible
624 JSON encoding baked in. Used all over the place.
626 JSON encoding baked in. Used all over the place.
625-}
627-}
626−data BooleanOperator = And | Or deriving (Eq, Show)
628+data BooleanOperator = And | Or deriving (Eq, Show, Typeable)
627
629
628{-| 'ShardCount' is part of 'IndexSettings'
630{-| 'ShardCount' is part of 'IndexSettings'
629-}
631-}
630−newtype ShardCount = ShardCount Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
632+newtype ShardCount = ShardCount Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
631
633
632{-| 'ReplicaCount' is part of 'IndexSettings'
634{-| 'ReplicaCount' is part of 'IndexSettings'
633-}
635-}
634−newtype ReplicaCount = ReplicaCount Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
636+newtype ReplicaCount = ReplicaCount Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
635
637
636{-| 'Server' is used with the client functions to point at the ES instance
638{-| 'Server' is used with the client functions to point at the ES instance
637-}
639-}
@@ -639,35 +641,35 @@ newtype Server = Server Text deriving (Eq, Show)
639
641
640{-| 'IndexName' is used to describe which index to query/create/delete
642{-| 'IndexName' is used to describe which index to query/create/delete
641-}
643-}
642−newtype IndexName = IndexName Text deriving (Eq, Generic, Show, ToJSON, FromJSON)
644+newtype IndexName = IndexName Text deriving (Eq, Generic, Show, ToJSON, FromJSON, Typeable)
643
645
644{-| 'TemplateName' is used to describe which template to query/create/delete
646{-| 'TemplateName' is used to describe which template to query/create/delete
645-}
647-}
646−newtype TemplateName = TemplateName Text deriving (Eq, Show, Generic, ToJSON, FromJSON)
648+newtype TemplateName = TemplateName Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
647
649
648{-| 'TemplatePattern' represents a pattern which is matched against index names
650{-| 'TemplatePattern' represents a pattern which is matched against index names
649-}
651-}
650−newtype TemplatePattern = TemplatePattern Text deriving (Eq, Show, Generic, ToJSON, FromJSON)
652+newtype TemplatePattern = TemplatePattern Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
651
653
652{-| 'MappingName' is part of mappings which are how ES describes and schematizes
654{-| 'MappingName' is part of mappings which are how ES describes and schematizes
653 the data in the indices.
655 the data in the indices.
654-}
656-}
655−newtype MappingName = MappingName Text deriving (Eq, Generic, Show, ToJSON, FromJSON)
657+newtype MappingName = MappingName Text deriving (Eq, Generic, Show, ToJSON, FromJSON, Typeable)
656
658
657{-| 'DocId' is a generic wrapper value for expressing unique Document IDs.
659{-| 'DocId' is a generic wrapper value for expressing unique Document IDs.
658 Can be set by the user or created by ES itself. Often used in client
660 Can be set by the user or created by ES itself. Often used in client
659 functions for poking at specific documents.
661 functions for poking at specific documents.
660-}
662-}
661−newtype DocId = DocId Text deriving (Eq, Generic, Show, ToJSON, FromJSON)
663+newtype DocId = DocId Text deriving (Eq, Generic, Show, ToJSON, FromJSON, Typeable)
662
664
663{-| 'QueryString' is used to wrap query text bodies, be they human written or not.
665{-| 'QueryString' is used to wrap query text bodies, be they human written or not.
664-}
666-}
665−newtype QueryString = QueryString Text deriving (Eq, Generic, Show, ToJSON, FromJSON)
667+newtype QueryString = QueryString Text deriving (Eq, Generic, Show, ToJSON, FromJSON, Typeable)
666
668
667{-| 'FieldName' is used all over the place wherever a specific field within
669{-| 'FieldName' is used all over the place wherever a specific field within
668 a document needs to be specified, usually in 'Query's or 'Filter's.
670 a document needs to be specified, usually in 'Query's or 'Filter's.
669-}
671-}
670−newtype FieldName = FieldName Text deriving (Eq, Show, ToJSON, FromJSON)
672+newtype FieldName = FieldName Text deriving (Eq, Show, ToJSON, FromJSON, Typeable)
671
673
672
674
673{-| 'Script' is often used in place of 'FieldName' to specify more
675{-| 'Script' is often used in place of 'FieldName' to specify more
@@ -678,98 +680,98 @@ newtype Script = Script { scriptText :: Text } deriving (Eq, Show)
678{-| 'CacheName' is used in 'RegexpFilter' for describing the
680{-| 'CacheName' is used in 'RegexpFilter' for describing the
679 'CacheKey' keyed caching behavior.
681 'CacheKey' keyed caching behavior.
680-}
682-}
681−newtype CacheName = CacheName Text deriving (Eq, Show, ToJSON, FromJSON)
683+newtype CacheName = CacheName Text deriving (Eq, Show, ToJSON, FromJSON, Typeable)
682
684
683{-| 'CacheKey' is used in 'RegexpFilter' to key regex caching.
685{-| 'CacheKey' is used in 'RegexpFilter' to key regex caching.
684-}
686-}
685newtype CacheKey =
687newtype CacheKey =
686− CacheKey Text deriving (Eq, Show, ToJSON, FromJSON)
688+ CacheKey Text deriving (Eq, Show, ToJSON, FromJSON, Typeable)
687newtype Existence =
689newtype Existence =
688− Existence Bool deriving (Eq, Show, ToJSON, FromJSON)
690+ Existence Bool deriving (Eq, Show, ToJSON, FromJSON, Typeable)
689newtype NullValue =
691newtype NullValue =
690− NullValue Bool deriving (Eq, Show, ToJSON, FromJSON)
692+ NullValue Bool deriving (Eq, Show, ToJSON, FromJSON, Typeable)
691newtype CutoffFrequency =
693newtype CutoffFrequency =
692− CutoffFrequency Double deriving (Eq, Show, Generic, ToJSON, FromJSON)
694+ CutoffFrequency Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
693newtype Analyzer =
695newtype Analyzer =
694− Analyzer Text deriving (Eq, Show, Generic, ToJSON, FromJSON)
696+ Analyzer Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
695newtype MaxExpansions =
697newtype MaxExpansions =
696− MaxExpansions Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
698+ MaxExpansions Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
697
699
698{-| 'Lenient', if set to true, will cause format based failures to be
700{-| 'Lenient', if set to true, will cause format based failures to be
699 ignored. I don't know what the bloody default is, Elasticsearch
701 ignored. I don't know what the bloody default is, Elasticsearch
700 documentation didn't say what it was. Let me know if you figure it out.
702 documentation didn't say what it was. Let me know if you figure it out.
701-}
703-}
702newtype Lenient =
704newtype Lenient =
703− Lenient Bool deriving (Eq, Show, Generic, ToJSON, FromJSON)
705+ Lenient Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
704newtype Tiebreaker =
706newtype Tiebreaker =
705− Tiebreaker Double deriving (Eq, Show, Generic, ToJSON, FromJSON)
707+ Tiebreaker Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
706newtype Boost =
708newtype Boost =
707− Boost Double deriving (Eq, Show, Generic, ToJSON, FromJSON)
709+ Boost Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
708newtype BoostTerms =
710newtype BoostTerms =
709− BoostTerms Double deriving (Eq, Show, Generic, ToJSON, FromJSON)
711+ BoostTerms Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
710
712
711{-| 'MinimumMatch' controls how many should clauses in the bool query should
713{-| 'MinimumMatch' controls how many should clauses in the bool query should
712 match. Can be an absolute value (2) or a percentage (30%) or a
714 match. Can be an absolute value (2) or a percentage (30%) or a
713 combination of both.
715 combination of both.
714-}
716-}
715newtype MinimumMatch =
717newtype MinimumMatch =
716− MinimumMatch Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
718+ MinimumMatch Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
717newtype DisableCoord =
719newtype DisableCoord =
718− DisableCoord Bool deriving (Eq, Show, Generic, ToJSON, FromJSON)
720+ DisableCoord Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
719newtype IgnoreTermFrequency =
721newtype IgnoreTermFrequency =
720− IgnoreTermFrequency Bool deriving (Eq, Show, Generic, ToJSON, FromJSON)
722+ IgnoreTermFrequency Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
721newtype MinimumTermFrequency =
723newtype MinimumTermFrequency =
722− MinimumTermFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
724+ MinimumTermFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
723newtype MaxQueryTerms =
725newtype MaxQueryTerms =
724− MaxQueryTerms Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
726+ MaxQueryTerms Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
725newtype Fuzziness =
727newtype Fuzziness =
726− Fuzziness Double deriving (Eq, Show, Generic, ToJSON, FromJSON)
728+ Fuzziness Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
727
729
728{-| 'PrefixLength' is the prefix length used in queries, defaults to 0. -}
730{-| 'PrefixLength' is the prefix length used in queries, defaults to 0. -}
729newtype PrefixLength =
731newtype PrefixLength =
730− PrefixLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
732+ PrefixLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
731newtype TypeName =
733newtype TypeName =
732− TypeName Text deriving (Eq, Show, Generic, ToJSON, FromJSON)
734+ TypeName Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
733newtype PercentMatch =
735newtype PercentMatch =
734− PercentMatch Double deriving (Eq, Show, Generic, ToJSON, FromJSON)
736+ PercentMatch Double deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
735newtype StopWord =
737newtype StopWord =
736− StopWord Text deriving (Eq, Show, Generic, ToJSON, FromJSON)
738+ StopWord Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
737newtype QueryPath =
739newtype QueryPath =
738− QueryPath Text deriving (Eq, Show, Generic, ToJSON, FromJSON)
740+ QueryPath Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
739
741
740{-| Allowing a wildcard at the beginning of a word (eg "*ing") is particularly
742{-| Allowing a wildcard at the beginning of a word (eg "*ing") is particularly
741 heavy, because all terms in the index need to be examined, just in case
743 heavy, because all terms in the index need to be examined, just in case
742 they match. Leading wildcards can be disabled by setting
744 they match. Leading wildcards can be disabled by setting
743 'AllowLeadingWildcard' to false. -}
745 'AllowLeadingWildcard' to false. -}
744newtype AllowLeadingWildcard =
746newtype AllowLeadingWildcard =
745− AllowLeadingWildcard Bool deriving (Eq, Show, Generic, ToJSON, FromJSON)
747+ AllowLeadingWildcard Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
746newtype LowercaseExpanded =
748newtype LowercaseExpanded =
747− LowercaseExpanded Bool deriving (Eq, Show, Generic, ToJSON, FromJSON)
749+ LowercaseExpanded Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
748newtype EnablePositionIncrements =
750newtype EnablePositionIncrements =
749− EnablePositionIncrements Bool deriving (Eq, Show, Generic, ToJSON, FromJSON)
751+ EnablePositionIncrements Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
750
752
751{-| By default, wildcard terms in a query are not analyzed.
753{-| By default, wildcard terms in a query are not analyzed.
752 Setting 'AnalyzeWildcard' to true enables best-effort analysis.
754 Setting 'AnalyzeWildcard' to true enables best-effort analysis.
753-}
755-}
754−newtype AnalyzeWildcard = AnalyzeWildcard Bool deriving (Eq, Show, Generic, ToJSON, FromJSON)
756+newtype AnalyzeWildcard = AnalyzeWildcard Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
755
757
756{-| 'GeneratePhraseQueries' defaults to false.
758{-| 'GeneratePhraseQueries' defaults to false.
757-}
759-}
758newtype GeneratePhraseQueries =
760newtype GeneratePhraseQueries =
759− GeneratePhraseQueries Bool deriving (Eq, Show, Generic, ToJSON, FromJSON)
761+ GeneratePhraseQueries Bool deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
760
762
761{-| 'Locale' is used for string conversions - defaults to ROOT.
763{-| 'Locale' is used for string conversions - defaults to ROOT.
762-}
764-}
763−newtype Locale = Locale Text deriving (Eq, Show, Generic, ToJSON, FromJSON)
765+newtype Locale = Locale Text deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
764−newtype MaxWordLength = MaxWordLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
766+newtype MaxWordLength = MaxWordLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
765−newtype MinWordLength = MinWordLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
767+newtype MinWordLength = MinWordLength Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
766
768
767{-| 'PhraseSlop' sets the default slop for phrases, 0 means exact
769{-| 'PhraseSlop' sets the default slop for phrases, 0 means exact
768 phrase matches. Default is 0.
770 phrase matches. Default is 0.
769-}
771-}
770−newtype PhraseSlop = PhraseSlop Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
772+newtype PhraseSlop = PhraseSlop Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
771−newtype MinDocFrequency = MinDocFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
773+newtype MinDocFrequency = MinDocFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
772−newtype MaxDocFrequency = MaxDocFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON)
774+newtype MaxDocFrequency = MaxDocFrequency Int deriving (Eq, Show, Generic, ToJSON, FromJSON, Typeable)
773
775
774{-| 'unpackId' is a silly convenience function that gets used once.
776{-| 'unpackId' is a silly convenience function that gets used once.
775-}
777-}
@@ -898,19 +900,19 @@ data Query =
898 | QuerySimpleQueryStringQuery SimpleQueryStringQuery
900 | QuerySimpleQueryStringQuery SimpleQueryStringQuery
899 | QueryRangeQuery RangeQuery
901 | QueryRangeQuery RangeQuery
900 | QueryRegexpQuery RegexpQuery
902 | QueryRegexpQuery RegexpQuery
901− deriving (Eq, Show)
903+ deriving (Eq, Show, Typeable)
902
904
903data RegexpQuery =
905data RegexpQuery =
904 RegexpQuery { regexpQueryField :: FieldName
906 RegexpQuery { regexpQueryField :: FieldName
905 , regexpQuery :: Regexp
907 , regexpQuery :: Regexp
906 , regexpQueryFlags :: RegexpFlags
908 , regexpQueryFlags :: RegexpFlags
907 , regexpQueryBoost :: Maybe Boost
909 , regexpQueryBoost :: Maybe Boost
908− } deriving (Eq, Show)
910+ } deriving (Eq, Show, Typeable)
909
911
910data RangeQuery =
912data RangeQuery =
911 RangeQuery { rangeQueryField :: FieldName
913 RangeQuery { rangeQueryField :: FieldName
912 , rangeQueryRange :: RangeValue
914 , rangeQueryRange :: RangeValue
913− , rangeQueryBoost :: Boost } deriving (Eq, Show)
915+ , rangeQueryBoost :: Boost } deriving (Eq, Show, Typeable)
914
916
915mkRangeQuery :: FieldName -> RangeValue -> RangeQuery
917mkRangeQuery :: FieldName -> RangeValue -> RangeQuery
916mkRangeQuery f r = RangeQuery f r (Boost 1.0)
918mkRangeQuery f r = RangeQuery f r (Boost 1.0)
@@ -938,7 +940,7 @@ data SimpleQueryFlag =
938 | SimpleQueryWhitespace
940 | SimpleQueryWhitespace
939 | SimpleQueryFuzzy
941 | SimpleQueryFuzzy
940 | SimpleQueryNear
942 | SimpleQueryNear
941− | SimpleQuerySlop deriving (Eq, Show)
943+ | SimpleQuerySlop deriving (Eq, Show, Typeable)
942
944
943-- use_dis_max and tie_breaker when fields are plural?
945-- use_dis_max and tie_breaker when fields are plural?
944data QueryStringQuery =
946data QueryStringQuery =
@@ -960,7 +962,7 @@ data QueryStringQuery =
960 , queryStringMinimumShouldMatch :: Maybe MinimumMatch
962 , queryStringMinimumShouldMatch :: Maybe MinimumMatch
961 , queryStringLenient :: Maybe Lenient
963 , queryStringLenient :: Maybe Lenient
962 , queryStringLocale :: Maybe Locale
964 , queryStringLocale :: Maybe Locale
963− } deriving (Eq, Show)
965+ } deriving (Eq, Show, Typeable)
964
966
965mkQueryStringQuery :: QueryString -> QueryStringQuery
967mkQueryStringQuery :: QueryString -> QueryStringQuery
966mkQueryStringQuery qs =
968mkQueryStringQuery qs =
@@ -971,19 +973,19 @@ mkQueryStringQuery qs =
971 Nothing Nothing
973 Nothing Nothing
972
974
973data FieldOrFields = FofField FieldName
975data FieldOrFields = FofField FieldName
974− | FofFields (NonEmpty FieldName) deriving (Eq, Show)
976+ | FofFields (NonEmpty FieldName) deriving (Eq, Show, Typeable)
975
977
976data PrefixQuery =
978data PrefixQuery =
977 PrefixQuery
979 PrefixQuery
978 { prefixQueryField :: FieldName
980 { prefixQueryField :: FieldName
979 , prefixQueryPrefixValue :: Text
981 , prefixQueryPrefixValue :: Text
980− , prefixQueryBoost :: Maybe Boost } deriving (Eq, Show)
982+ , prefixQueryBoost :: Maybe Boost } deriving (Eq, Show, Typeable)
981
983
982data NestedQuery =
984data NestedQuery =
983 NestedQuery
985 NestedQuery
984 { nestedQueryPath :: QueryPath
986 { nestedQueryPath :: QueryPath
985 , nestedQueryScoreType :: ScoreType
987 , nestedQueryScoreType :: ScoreType
986− , nestedQuery :: Query } deriving (Eq, Show)
988+ , nestedQuery :: Query } deriving (Eq, Show, Typeable)
987
989
988data MoreLikeThisFieldQuery =
990data MoreLikeThisFieldQuery =
989 MoreLikeThisFieldQuery
991 MoreLikeThisFieldQuery
@@ -1001,7 +1003,7 @@ data MoreLikeThisFieldQuery =
1001 , moreLikeThisFieldBoostTerms :: Maybe BoostTerms
1003 , moreLikeThisFieldBoostTerms :: Maybe BoostTerms
1002 , moreLikeThisFieldBoost :: Maybe Boost
1004 , moreLikeThisFieldBoost :: Maybe Boost
1003 , moreLikeThisFieldAnalyzer :: Maybe Analyzer
1005 , moreLikeThisFieldAnalyzer :: Maybe Analyzer
1004− } deriving (Eq, Show)
1006+ } deriving (Eq, Show, Typeable)
1005
1007
1006data MoreLikeThisQuery =
1008data MoreLikeThisQuery =
1007 MoreLikeThisQuery
1009 MoreLikeThisQuery
@@ -1019,32 +1021,32 @@ data MoreLikeThisQuery =
1019 , moreLikeThisBoostTerms :: Maybe BoostTerms
1021 , moreLikeThisBoostTerms :: Maybe BoostTerms
1020 , moreLikeThisBoost :: Maybe Boost
1022 , moreLikeThisBoost :: Maybe Boost
1021 , moreLikeThisAnalyzer :: Maybe Analyzer
1023 , moreLikeThisAnalyzer :: Maybe Analyzer
1022− } deriving (Eq, Show)
1024+ } deriving (Eq, Show, Typeable)
1023
1025
1024data IndicesQuery =
1026data IndicesQuery =
1025 IndicesQuery
1027 IndicesQuery
1026 { indicesQueryIndices :: [IndexName]
1028 { indicesQueryIndices :: [IndexName]
1027 , indicesQuery :: Query
1029 , indicesQuery :: Query
1028 -- default "all"
1030 -- default "all"
1029− , indicesQueryNoMatch :: Maybe Query } deriving (Eq, Show)
1031+ , indicesQueryNoMatch :: Maybe Query } deriving (Eq, Show, Typeable)
1030
1032
1031data HasParentQuery =
1033data HasParentQuery =
1032 HasParentQuery
1034 HasParentQuery
1033 { hasParentQueryType :: TypeName
1035 { hasParentQueryType :: TypeName
1034 , hasParentQuery :: Query
1036 , hasParentQuery :: Query
1035− , hasParentQueryScoreType :: Maybe ScoreType } deriving (Eq, Show)
1037+ , hasParentQueryScoreType :: Maybe ScoreType } deriving (Eq, Show, Typeable)
1036
1038
1037data HasChildQuery =
1039data HasChildQuery =
1038 HasChildQuery
1040 HasChildQuery
1039 { hasChildQueryType :: TypeName
1041 { hasChildQueryType :: TypeName
1040 , hasChildQuery :: Query
1042 , hasChildQuery :: Query
1041− , hasChildQueryScoreType :: Maybe ScoreType } deriving (Eq, Show)
1043+ , hasChildQueryScoreType :: Maybe ScoreType } deriving (Eq, Show, Typeable)
1042
1044
1043data ScoreType =
1045data ScoreType =
1044 ScoreTypeMax
1046 ScoreTypeMax
1045 | ScoreTypeSum
1047 | ScoreTypeSum
1046 | ScoreTypeAvg
1048 | ScoreTypeAvg
1047− | ScoreTypeNone deriving (Eq, Show)
1049+ | ScoreTypeNone deriving (Eq, Show, Typeable)
1048
1050
1049data FuzzyQuery =
1051data FuzzyQuery =
1050 FuzzyQuery { fuzzyQueryField :: FieldName
1052 FuzzyQuery { fuzzyQueryField :: FieldName
@@ -1053,7 +1055,7 @@ data FuzzyQuery =
1053 , fuzzyQueryMaxExpansions :: MaxExpansions
1055 , fuzzyQueryMaxExpansions :: MaxExpansions
1054 , fuzzyQueryFuzziness :: Fuzziness
1056 , fuzzyQueryFuzziness :: Fuzziness
1055 , fuzzyQueryBoost :: Maybe Boost
1057 , fuzzyQueryBoost :: Maybe Boost
1056− } deriving (Eq, Show)
1058+ } deriving (Eq, Show, Typeable)
1057
1059
1058data FuzzyLikeFieldQuery =
1060data FuzzyLikeFieldQuery =
1059 FuzzyLikeFieldQuery
1061 FuzzyLikeFieldQuery
@@ -1078,19 +1080,19 @@ data FuzzyLikeThisQuery =
1078 , fuzzyLikePrefixLength :: PrefixLength
1080 , fuzzyLikePrefixLength :: PrefixLength
1079 , fuzzyLikeBoost :: Boost
1081 , fuzzyLikeBoost :: Boost
1080 , fuzzyLikeAnalyzer :: Maybe Analyzer
1082 , fuzzyLikeAnalyzer :: Maybe Analyzer
1081− } deriving (Eq, Show)
1083+ } deriving (Eq, Show, Typeable)
1082
1084
1083data FilteredQuery =
1085data FilteredQuery =
1084 FilteredQuery
1086 FilteredQuery
1085 { filteredQuery :: Query
1087 { filteredQuery :: Query
1086− , filteredFilter :: Filter } deriving (Eq, Show)
1088+ , filteredFilter :: Filter } deriving (Eq, Show, Typeable)
1087
1089
1088data DisMaxQuery =
1090data DisMaxQuery =
1089 DisMaxQuery { disMaxQueries :: [Query]
1091 DisMaxQuery { disMaxQueries :: [Query]
1090 -- default 0.0
1092 -- default 0.0
1091 , disMaxTiebreaker :: Tiebreaker
1093 , disMaxTiebreaker :: Tiebreaker
1092 , disMaxBoost :: Maybe Boost
1094 , disMaxBoost :: Maybe Boost
1093− } deriving (Eq, Show)
1095+ } deriving (Eq, Show, Typeable)
1094
1096
1095data MatchQuery =
1097data MatchQuery =
1096 MatchQuery { matchQueryField :: FieldName
1098 MatchQuery { matchQueryField :: FieldName
@@ -1102,7 +1104,7 @@ data MatchQuery =
1102 , matchQueryAnalyzer :: Maybe Analyzer
1104 , matchQueryAnalyzer :: Maybe Analyzer
1103 , matchQueryMaxExpansions :: Maybe MaxExpansions
1105 , matchQueryMaxExpansions :: Maybe MaxExpansions
1104 , matchQueryLenient :: Maybe Lenient
1106 , matchQueryLenient :: Maybe Lenient
1105− , matchQueryBoost :: Maybe Boost } deriving (Eq, Show)
1107+ , matchQueryBoost :: Maybe Boost } deriving (Eq, Show, Typeable)
1106
1108
1107{-| 'mkMatchQuery' is a convenience function that defaults the less common parameters,
1109{-| 'mkMatchQuery' is a convenience function that defaults the less common parameters,
1108 enabling you to provide only the 'FieldName' and 'QueryString' to make a 'MatchQuery'
1110 enabling you to provide only the 'FieldName' and 'QueryString' to make a 'MatchQuery'
@@ -1112,7 +1114,7 @@ mkMatchQuery field query = MatchQuery field query Or ZeroTermsNone Nothing Nothi
1112
1114
1113data MatchQueryType =
1115data MatchQueryType =
1114 MatchPhrase
1116 MatchPhrase
1115− | MatchPhrasePrefix deriving (Eq, Show)
1117+ | MatchPhrasePrefix deriving (Eq, Show, Typeable)
1116
1118
1117data MultiMatchQuery =
1119data MultiMatchQuery =
1118 MultiMatchQuery { multiMatchQueryFields :: [FieldName]
1120 MultiMatchQuery { multiMatchQueryFields :: [FieldName]
@@ -1124,7 +1126,7 @@ data MultiMatchQuery =
1124 , multiMatchQueryCutoffFrequency :: Maybe CutoffFrequency
1126 , multiMatchQueryCutoffFrequency :: Maybe CutoffFrequency
1125 , multiMatchQueryAnalyzer :: Maybe Analyzer
1127 , multiMatchQueryAnalyzer :: Maybe Analyzer
1126 , multiMatchQueryMaxExpansions :: Maybe MaxExpansions
1128 , multiMatchQueryMaxExpansions :: Maybe MaxExpansions
1127− , multiMatchQueryLenient :: Maybe Lenient } deriving (Eq, Show)
1129+ , multiMatchQueryLenient :: Maybe Lenient } deriving (Eq, Show, Typeable)
1128
1130
1129{-| 'mkMultiMatchQuery' is a convenience function that defaults the less common parameters,
1131{-| 'mkMultiMatchQuery' is a convenience function that defaults the less common parameters,
1130 enabling you to provide only the list of 'FieldName's and 'QueryString' to
1132 enabling you to provide only the list of 'FieldName's and 'QueryString' to
@@ -1141,7 +1143,7 @@ data MultiMatchQueryType =
1141 | MultiMatchMostFields
1143 | MultiMatchMostFields
1142 | MultiMatchCrossFields
1144 | MultiMatchCrossFields
1143 | MultiMatchPhrase
1145 | MultiMatchPhrase
1144− | MultiMatchPhrasePrefix deriving (Eq, Show)
1146+ | MultiMatchPhrasePrefix deriving (Eq, Show, Typeable)
1145
1147
1146data BoolQuery =
1148data BoolQuery =
1147 BoolQuery { boolQueryMustMatch :: [Query]
1149 BoolQuery { boolQueryMustMatch :: [Query]
@@ -1150,7 +1152,7 @@ data BoolQuery =
1150 , boolQueryMinimumShouldMatch :: Maybe MinimumMatch
1152 , boolQueryMinimumShouldMatch :: Maybe MinimumMatch
1151 , boolQueryBoost :: Maybe Boost
1153 , boolQueryBoost :: Maybe Boost
1152 , boolQueryDisableCoord :: Maybe DisableCoord
1154 , boolQueryDisableCoord :: Maybe DisableCoord
1153− } deriving (Eq, Show)
1155+ } deriving (Eq, Show, Typeable)
1154
1156
1155mkBoolQuery :: [Query] -> [Query] -> [Query] -> BoolQuery
1157mkBoolQuery :: [Query] -> [Query] -> [Query] -> BoolQuery
1156mkBoolQuery must mustNot should =
1158mkBoolQuery must mustNot should =
@@ -1159,7 +1161,7 @@ mkBoolQuery must mustNot should =
1159data BoostingQuery =
1161data BoostingQuery =
1160 BoostingQuery { positiveQuery :: Query
1162 BoostingQuery { positiveQuery :: Query
1161 , negativeQuery :: Query
1163 , negativeQuery :: Query
1162− , negativeBoost :: Boost } deriving (Eq, Show)
1164+ , negativeBoost :: Boost } deriving (Eq, Show, Typeable)
1163
1165
1164data CommonTermsQuery =
1166data CommonTermsQuery =
1165 CommonTermsQuery { commonField :: FieldName
1167 CommonTermsQuery { commonField :: FieldName
@@ -1171,16 +1173,16 @@ data CommonTermsQuery =
1171 , commonBoost :: Maybe Boost
1173 , commonBoost :: Maybe Boost
1172 , commonAnalyzer :: Maybe Analyzer
1174 , commonAnalyzer :: Maybe Analyzer
1173 , commonDisableCoord :: Maybe DisableCoord
1175 , commonDisableCoord :: Maybe DisableCoord
1174− } deriving (Eq, Show)
1176+ } deriving (Eq, Show, Typeable)
1175
1177
1176data CommonMinimumMatch =
1178data CommonMinimumMatch =
1177 CommonMinimumMatchHighLow MinimumMatchHighLow
1179 CommonMinimumMatchHighLow MinimumMatchHighLow
1178 | CommonMinimumMatch MinimumMatch
1180 | CommonMinimumMatch MinimumMatch
1179− deriving (Eq, Show)
1181+ deriving (Eq, Show, Typeable)
1180
1182
1181data MinimumMatchHighLow =
1183data MinimumMatchHighLow =
1182 MinimumMatchHighLow { lowFreq :: MinimumMatch
1184 MinimumMatchHighLow { lowFreq :: MinimumMatch
1183− , highFreq :: MinimumMatch } deriving (Eq, Show)
1185+ , highFreq :: MinimumMatch } deriving (Eq, Show, Typeable)
1184
1186
1185data Filter = AndFilter [Filter] Cache
1187data Filter = AndFilter [Filter] Cache
1186 | OrFilter [Filter] Cache
1188 | OrFilter [Filter] Cache
@@ -1200,13 +1202,13 @@ data Filter = AndFilter [Filter] Cache
1200 | RangeFilter FieldName RangeValue RangeExecution Cache
1202 | RangeFilter FieldName RangeValue RangeExecution Cache
1201 | RegexpFilter FieldName Regexp RegexpFlags CacheName Cache CacheKey
1203 | RegexpFilter FieldName Regexp RegexpFlags CacheName Cache CacheKey
1202 | TermFilter Term Cache
1204 | TermFilter Term Cache
1203− deriving (Eq, Show)
1205+ deriving (Eq, Show, Typeable)
1204
1206
1205data ZeroTermsQuery = ZeroTermsNone
1207data ZeroTermsQuery = ZeroTermsNone
1206− | ZeroTermsAll deriving (Eq, Show)
1208+ | ZeroTermsAll deriving (Eq, Show, Typeable)
1207
1209
1208data RangeExecution = RangeExecutionIndex
1210data RangeExecution = RangeExecutionIndex
1209− | RangeExecutionFielddata deriving (Eq, Show)
1211+ | RangeExecutionFielddata deriving (Eq, Show, Typeable)
1210
1212
1211newtype Regexp = Regexp Text deriving (Eq, Show, FromJSON)
1213newtype Regexp = Regexp Text deriving (Eq, Show, FromJSON)
1212
1214
@@ -1269,33 +1271,33 @@ rangeValueToPair rv = case rv of
1269 RangeDoubleGtLt (GreaterThan l) (LessThan g) -> ["gt" .= l, "lt" .= g]
1271 RangeDoubleGtLt (GreaterThan l) (LessThan g) -> ["gt" .= l, "lt" .= g]
1270
1272
1271data Term = Term { termField :: Text
1273data Term = Term { termField :: Text
1272− , termValue :: Text } deriving (Eq, Show)
1274+ , termValue :: Text } deriving (Eq, Show, Typeable)
1273
1275
1274data BoolMatch = MustMatch Term Cache
1276data BoolMatch = MustMatch Term Cache
1275 | MustNotMatch Term Cache
1277 | MustNotMatch Term Cache
1276− | ShouldMatch [Term] Cache deriving (Eq, Show)
1278+ | ShouldMatch [Term] Cache deriving (Eq, Show, Typeable)
1277
1279
1278-- "memory" or "indexed"
1280-- "memory" or "indexed"
1279data GeoFilterType = GeoFilterMemory
1281data GeoFilterType = GeoFilterMemory
1280− | GeoFilterIndexed deriving (Eq, Show)
1282+ | GeoFilterIndexed deriving (Eq, Show, Typeable)
1281
1283
1282data LatLon = LatLon { lat :: Double
1284data LatLon = LatLon { lat :: Double
1283− , lon :: Double } deriving (Eq, Show)
1285+ , lon :: Double } deriving (Eq, Show, Typeable)
1284
1286
1285data GeoBoundingBox =
1287data GeoBoundingBox =
1286 GeoBoundingBox { topLeft :: LatLon
1288 GeoBoundingBox { topLeft :: LatLon
1287− , bottomRight :: LatLon } deriving (Eq, Show)
1289+ , bottomRight :: LatLon } deriving (Eq, Show, Typeable)
1288
1290
1289data GeoBoundingBoxConstraint =
1291data GeoBoundingBoxConstraint =
1290 GeoBoundingBoxConstraint { geoBBField :: FieldName
1292 GeoBoundingBoxConstraint { geoBBField :: FieldName
1291 , constraintBox :: GeoBoundingBox
1293 , constraintBox :: GeoBoundingBox
1292 , bbConstraintcache :: Cache
1294 , bbConstraintcache :: Cache
1293 , geoType :: GeoFilterType
1295 , geoType :: GeoFilterType
1294− } deriving (Eq, Show)
1296+ } deriving (Eq, Show, Typeable)
1295
1297
1296data GeoPoint =
1298data GeoPoint =
1297 GeoPoint { geoField :: FieldName
1299 GeoPoint { geoField :: FieldName
1298− , latLon :: LatLon} deriving (Eq, Show)
1300+ , latLon :: LatLon} deriving (Eq, Show, Typeable)
1299
1301
1300data DistanceUnit = Miles
1302data DistanceUnit = Miles
1301 | Yards
1303 | Yards
@@ -1305,18 +1307,18 @@ data DistanceUnit = Miles
1305 | Meters
1307 | Meters
1306 | Centimeters
1308 | Centimeters
1307 | Millimeters
1309 | Millimeters
1308− | NauticalMiles deriving (Eq, Show)
1310+ | NauticalMiles deriving (Eq, Show, Typeable)
1309
1311
1310data DistanceType = Arc
1312data DistanceType = Arc
1311 | SloppyArc -- doesn't exist <1.0
1313 | SloppyArc -- doesn't exist <1.0
1312− | Plane deriving (Eq, Show)
1314+ | Plane deriving (Eq, Show, Typeable)
1313
1315
1314data OptimizeBbox = OptimizeGeoFilterType GeoFilterType
1316data OptimizeBbox = OptimizeGeoFilterType GeoFilterType
1315− | NoOptimizeBbox deriving (Eq, Show)
1317+ | NoOptimizeBbox deriving (Eq, Show, Typeable)
1316
1318
1317data Distance =
1319data Distance =
1318 Distance { coefficient :: Double
1320 Distance { coefficient :: Double
1319− , unit :: DistanceUnit } deriving (Eq, Show)
1321+ , unit :: DistanceUnit } deriving (Eq, Show, Typeable)
1320
1322
1321data DistanceRange =
1323data DistanceRange =
1322 DistanceRange { distanceFrom :: Distance
1324 DistanceRange { distanceFrom :: Distance