@@ -421,6 +421,7 @@ import Database.V5.Bloodhound.Types.Class
421import Database.V5.Bloodhound.Internal.Analysis
421import Database.V5.Bloodhound.Internal.Analysis
422import Database.V5.Bloodhound.Internal.Aggregation
422import Database.V5.Bloodhound.Internal.Aggregation
423import Database.V5.Bloodhound.Internal.Client
423import Database.V5.Bloodhound.Internal.Client
424+import Database.V5.Bloodhound.Internal.Highlight
424import Database.V5.Bloodhound.Internal.Newtypes
425import Database.V5.Bloodhound.Internal.Newtypes
425import Database.V5.Bloodhound.Internal.Query
426import Database.V5.Bloodhound.Internal.Query
426import Database.V5.Bloodhound.Internal.Sort
427import Database.V5.Bloodhound.Internal.Sort
@@ -491,74 +492,6 @@ data Exclude = Exclude [Pattern] deriving (Eq, Read, Show)
492newtype Pattern = Pattern Text deriving (Eq, Read, Show)
493newtype Pattern = Pattern Text deriving (Eq, Read, Show)
494−data Highlights = Highlights
495− { globalsettings :: Maybe HighlightSettings
496− , highlightFields :: [FieldHighlight]
497− } deriving (Eq, Show)
499−data FieldHighlight =
500− FieldHighlight FieldName (Maybe HighlightSettings)
504−data HighlightSettings =
505− Plain PlainHighlight
506− | Postings PostingsHighlight
507− | FastVector FastVectorHighlight
510−data PlainHighlight =
511− PlainHighlight { plainCommon :: Maybe CommonHighlight
512− , plainNonPost :: Maybe NonPostings }
515− -- This requires that index_options are set to 'offset' in the mapping.
516−data PostingsHighlight =
517− PostingsHighlight (Maybe CommonHighlight)
520−-- This requires that term_vector is set to 'with_positions_offsets' in the mapping.
521−data FastVectorHighlight = FastVectorHighlight
522− { fvCommon :: Maybe CommonHighlight
523− , fvNonPostSettings :: Maybe NonPostings
524− , boundaryChars :: Maybe Text
525− , boundaryMaxScan :: Maybe Int
526− , fragmentOffset :: Maybe Int
527− , matchedFields :: [Text]
528− , phraseLimit :: Maybe Int
529− } deriving (Eq, Show)
531−data CommonHighlight = CommonHighlight
532− { order :: Maybe Text
533− , forceSource :: Maybe Bool
534− , tag :: Maybe HighlightTag
535− , encoder :: Maybe HighlightEncoder
536− , noMatchSize :: Maybe Int
537− , highlightQuery :: Maybe Query
538− , requireFieldMatch :: Maybe Bool
539− } deriving (Eq, Show)
541−-- Settings that are only applicable to FastVector and Plain highlighters.
543− NonPostings { fragmentSize :: Maybe Int
544− , numberOfFragments :: Maybe Int
545− } deriving (Eq, Show)
547−data HighlightEncoder = DefaultEncoder
551−instance ToJSON HighlightEncoder where
552− toJSON DefaultEncoder = String "default"
553− toJSON HTMLEncoder = String "html"
555−-- NOTE: Should the tags use some kind of HTML type, rather than Text?
558− -- Only uses more than the first value in the lists if fvh
559− | CustomTags ([Text], [Text])
562data SearchResult a =
495data SearchResult a =
563 SearchResult { took :: Int
496 SearchResult { took :: Int
564 , timedOut :: Bool
497 , timedOut :: Bool
@@ -627,16 +560,6 @@ instance (FromJSON a) => FromJSON (Hit a) where
627 v .:? "highlight"
560 v .:? "highlight"
628 parseJSON _ = empty
561 parseJSON _ = empty
631− HitFields (M.Map Text [Value])
634−instance FromJSON HitFields where
636− = HitFields <$> parseJSON x
638−type HitHighlight = M.Map Text [Text]
640data MissingResult = MissingResult
563data MissingResult = MissingResult
641 { missingDocCount :: Int
564 { missingDocCount :: Int
642 } deriving (Show)
565 } deriving (Show)