@@ -421,6 +421,7 @@ import Database.V5.Bloodhound.Types.Class
421421import Database.V5.Bloodhound.Internal.Analysis
422422import Database.V5.Bloodhound.Internal.Aggregation
423423import Database.V5.Bloodhound.Internal.Client
424+import Database.V5.Bloodhound.Internal.Highlight
424425import Database.V5.Bloodhound.Internal.Newtypes
425426import Database.V5.Bloodhound.Internal.Query
426427import Database.V5.Bloodhound.Internal.Sort
@@ -491,74 +492,6 @@ data Exclude = Exclude [Pattern] deriving (Eq, Read, Show)
491492
492493newtype Pattern = Pattern Text deriving (Eq, Read, Show)
493494
494−data Highlights = Highlights
495− { globalsettings :: Maybe HighlightSettings
496− , highlightFields :: [FieldHighlight]
497− } deriving (Eq, Show)
498−
499−data FieldHighlight =
500− FieldHighlight FieldName (Maybe HighlightSettings)
501− deriving (Eq, Show)
502−
503−
504−data HighlightSettings =
505− Plain PlainHighlight
506− | Postings PostingsHighlight
507− | FastVector FastVectorHighlight
508− deriving (Eq, Show)
509−
510−data PlainHighlight =
511− PlainHighlight { plainCommon :: Maybe CommonHighlight
512− , plainNonPost :: Maybe NonPostings }
513− deriving (Eq, Show)
514−
515− -- This requires that index_options are set to 'offset' in the mapping.
516−data PostingsHighlight =
517− PostingsHighlight (Maybe CommonHighlight)
518− deriving (Eq, Show)
519−
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)
530−
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)
540−
541−-- Settings that are only applicable to FastVector and Plain highlighters.
542−data NonPostings =
543− NonPostings { fragmentSize :: Maybe Int
544− , numberOfFragments :: Maybe Int
545− } deriving (Eq, Show)
546−
547−data HighlightEncoder = DefaultEncoder
548− | HTMLEncoder
549− deriving (Eq, Show)
550−
551−instance ToJSON HighlightEncoder where
552− toJSON DefaultEncoder = String "default"
553− toJSON HTMLEncoder = String "html"
554−
555−-- NOTE: Should the tags use some kind of HTML type, rather than Text?
556−data HighlightTag =
557− TagSchema Text
558− -- Only uses more than the first value in the lists if fvh
559− | CustomTags ([Text], [Text])
560− deriving (Eq, Show)
561−
562495data SearchResult a =
563496 SearchResult { took :: Int
564497 , timedOut :: Bool
@@ -627,16 +560,6 @@ instance (FromJSON a) => FromJSON (Hit a) where
627560 v .:? "highlight"
628561 parseJSON _ = empty
629562
630−newtype HitFields =
631− HitFields (M.Map Text [Value])
632− deriving (Eq, Show)
633−
634−instance FromJSON HitFields where
635− parseJSON x
636− = HitFields <$> parseJSON x
637−
638−type HitHighlight = M.Map Text [Text]
639−
640563data MissingResult = MissingResult
641564 { missingDocCount :: Int
642565 } deriving (Show)