{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.CloudSearchDomains.Types.Hit where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Hit = Hit'
{
Hit -> Maybe (HashMap Text Text)
exprs :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Hit -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
Hit -> Maybe (HashMap Text Text)
highlights :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
Hit -> Maybe (HashMap Text [Text])
fields :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text])
}
deriving (Hit -> Hit -> Bool
(Hit -> Hit -> Bool) -> (Hit -> Hit -> Bool) -> Eq Hit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Hit -> Hit -> Bool
$c/= :: Hit -> Hit -> Bool
== :: Hit -> Hit -> Bool
$c== :: Hit -> Hit -> Bool
Prelude.Eq, ReadPrec [Hit]
ReadPrec Hit
Int -> ReadS Hit
ReadS [Hit]
(Int -> ReadS Hit)
-> ReadS [Hit] -> ReadPrec Hit -> ReadPrec [Hit] -> Read Hit
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Hit]
$creadListPrec :: ReadPrec [Hit]
readPrec :: ReadPrec Hit
$creadPrec :: ReadPrec Hit
readList :: ReadS [Hit]
$creadList :: ReadS [Hit]
readsPrec :: Int -> ReadS Hit
$creadsPrec :: Int -> ReadS Hit
Prelude.Read, Int -> Hit -> ShowS
[Hit] -> ShowS
Hit -> String
(Int -> Hit -> ShowS)
-> (Hit -> String) -> ([Hit] -> ShowS) -> Show Hit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Hit] -> ShowS
$cshowList :: [Hit] -> ShowS
show :: Hit -> String
$cshow :: Hit -> String
showsPrec :: Int -> Hit -> ShowS
$cshowsPrec :: Int -> Hit -> ShowS
Prelude.Show, (forall x. Hit -> Rep Hit x)
-> (forall x. Rep Hit x -> Hit) -> Generic Hit
forall x. Rep Hit x -> Hit
forall x. Hit -> Rep Hit x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Hit x -> Hit
$cfrom :: forall x. Hit -> Rep Hit x
Prelude.Generic)
newHit ::
Hit
newHit :: Hit
newHit =
Hit' :: Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text [Text])
-> Hit
Hit'
{ $sel:exprs:Hit' :: Maybe (HashMap Text Text)
exprs = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:id:Hit' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:highlights:Hit' :: Maybe (HashMap Text Text)
highlights = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
$sel:fields:Hit' :: Maybe (HashMap Text [Text])
fields = Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing
}
hit_exprs :: Lens.Lens' Hit (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
hit_exprs :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Hit -> f Hit
hit_exprs = (Hit -> Maybe (HashMap Text Text))
-> (Hit -> Maybe (HashMap Text Text) -> Hit)
-> Lens
Hit Hit (Maybe (HashMap Text Text)) (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Hit' {Maybe (HashMap Text Text)
exprs :: Maybe (HashMap Text Text)
$sel:exprs:Hit' :: Hit -> Maybe (HashMap Text Text)
exprs} -> Maybe (HashMap Text Text)
exprs) (\s :: Hit
s@Hit' {} Maybe (HashMap Text Text)
a -> Hit
s {$sel:exprs:Hit' :: Maybe (HashMap Text Text)
exprs = Maybe (HashMap Text Text)
a} :: Hit) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Hit -> f Hit)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Hit
-> f Hit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
hit_id :: Lens.Lens' Hit (Prelude.Maybe Prelude.Text)
hit_id :: (Maybe Text -> f (Maybe Text)) -> Hit -> f Hit
hit_id = (Hit -> Maybe Text)
-> (Hit -> Maybe Text -> Hit)
-> Lens Hit Hit (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Hit' {Maybe Text
id :: Maybe Text
$sel:id:Hit' :: Hit -> Maybe Text
id} -> Maybe Text
id) (\s :: Hit
s@Hit' {} Maybe Text
a -> Hit
s {$sel:id:Hit' :: Maybe Text
id = Maybe Text
a} :: Hit)
hit_highlights :: Lens.Lens' Hit (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
hit_highlights :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Hit -> f Hit
hit_highlights = (Hit -> Maybe (HashMap Text Text))
-> (Hit -> Maybe (HashMap Text Text) -> Hit)
-> Lens
Hit Hit (Maybe (HashMap Text Text)) (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Hit' {Maybe (HashMap Text Text)
highlights :: Maybe (HashMap Text Text)
$sel:highlights:Hit' :: Hit -> Maybe (HashMap Text Text)
highlights} -> Maybe (HashMap Text Text)
highlights) (\s :: Hit
s@Hit' {} Maybe (HashMap Text Text)
a -> Hit
s {$sel:highlights:Hit' :: Maybe (HashMap Text Text)
highlights = Maybe (HashMap Text Text)
a} :: Hit) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Hit -> f Hit)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> Hit
-> f Hit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
-> Iso
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
(Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
(HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
hit_fields :: Lens.Lens' Hit (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
hit_fields :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> Hit -> f Hit
hit_fields = (Hit -> Maybe (HashMap Text [Text]))
-> (Hit -> Maybe (HashMap Text [Text]) -> Hit)
-> Lens
Hit Hit (Maybe (HashMap Text [Text])) (Maybe (HashMap Text [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Hit' {Maybe (HashMap Text [Text])
fields :: Maybe (HashMap Text [Text])
$sel:fields:Hit' :: Hit -> Maybe (HashMap Text [Text])
fields} -> Maybe (HashMap Text [Text])
fields) (\s :: Hit
s@Hit' {} Maybe (HashMap Text [Text])
a -> Hit
s {$sel:fields:Hit' :: Maybe (HashMap Text [Text])
fields = Maybe (HashMap Text [Text])
a} :: Hit) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> Hit -> f Hit)
-> ((Maybe (HashMap Text [Text])
-> f (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> Hit
-> f Hit
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
-> Iso
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
(Maybe (HashMap Text [Text]))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
(HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.FromJSON Hit where
parseJSON :: Value -> Parser Hit
parseJSON =
String -> (Object -> Parser Hit) -> Value -> Parser Hit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Hit"
( \Object
x ->
Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text [Text])
-> Hit
Hit'
(Maybe (HashMap Text Text)
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe (HashMap Text [Text])
-> Hit)
-> Parser (Maybe (HashMap Text Text))
-> Parser
(Maybe Text
-> Maybe (HashMap Text Text) -> Maybe (HashMap Text [Text]) -> Hit)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"exprs" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe Text
-> Maybe (HashMap Text Text) -> Maybe (HashMap Text [Text]) -> Hit)
-> Parser (Maybe Text)
-> Parser
(Maybe (HashMap Text Text) -> Maybe (HashMap Text [Text]) -> Hit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
Parser
(Maybe (HashMap Text Text) -> Maybe (HashMap Text [Text]) -> Hit)
-> Parser (Maybe (HashMap Text Text))
-> Parser (Maybe (HashMap Text [Text]) -> Hit)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"highlights" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
Parser (Maybe (HashMap Text [Text]) -> Hit)
-> Parser (Maybe (HashMap Text [Text])) -> Parser Hit
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text [Text])))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"fields" Parser (Maybe (Maybe (HashMap Text [Text])))
-> Maybe (HashMap Text [Text])
-> Parser (Maybe (HashMap Text [Text]))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text [Text])
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable Hit
instance Prelude.NFData Hit