{-# 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.CloudSearch.Types.DocumentSuggesterOptions where
import Amazonka.CloudSearch.Types.SuggesterFuzzyMatching
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data DocumentSuggesterOptions = DocumentSuggesterOptions'
{
DocumentSuggesterOptions -> Maybe Text
sortExpression :: Prelude.Maybe Prelude.Text,
DocumentSuggesterOptions -> Maybe SuggesterFuzzyMatching
fuzzyMatching :: Prelude.Maybe SuggesterFuzzyMatching,
DocumentSuggesterOptions -> Text
sourceField :: Prelude.Text
}
deriving (DocumentSuggesterOptions -> DocumentSuggesterOptions -> Bool
(DocumentSuggesterOptions -> DocumentSuggesterOptions -> Bool)
-> (DocumentSuggesterOptions -> DocumentSuggesterOptions -> Bool)
-> Eq DocumentSuggesterOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DocumentSuggesterOptions -> DocumentSuggesterOptions -> Bool
$c/= :: DocumentSuggesterOptions -> DocumentSuggesterOptions -> Bool
== :: DocumentSuggesterOptions -> DocumentSuggesterOptions -> Bool
$c== :: DocumentSuggesterOptions -> DocumentSuggesterOptions -> Bool
Prelude.Eq, ReadPrec [DocumentSuggesterOptions]
ReadPrec DocumentSuggesterOptions
Int -> ReadS DocumentSuggesterOptions
ReadS [DocumentSuggesterOptions]
(Int -> ReadS DocumentSuggesterOptions)
-> ReadS [DocumentSuggesterOptions]
-> ReadPrec DocumentSuggesterOptions
-> ReadPrec [DocumentSuggesterOptions]
-> Read DocumentSuggesterOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DocumentSuggesterOptions]
$creadListPrec :: ReadPrec [DocumentSuggesterOptions]
readPrec :: ReadPrec DocumentSuggesterOptions
$creadPrec :: ReadPrec DocumentSuggesterOptions
readList :: ReadS [DocumentSuggesterOptions]
$creadList :: ReadS [DocumentSuggesterOptions]
readsPrec :: Int -> ReadS DocumentSuggesterOptions
$creadsPrec :: Int -> ReadS DocumentSuggesterOptions
Prelude.Read, Int -> DocumentSuggesterOptions -> ShowS
[DocumentSuggesterOptions] -> ShowS
DocumentSuggesterOptions -> String
(Int -> DocumentSuggesterOptions -> ShowS)
-> (DocumentSuggesterOptions -> String)
-> ([DocumentSuggesterOptions] -> ShowS)
-> Show DocumentSuggesterOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DocumentSuggesterOptions] -> ShowS
$cshowList :: [DocumentSuggesterOptions] -> ShowS
show :: DocumentSuggesterOptions -> String
$cshow :: DocumentSuggesterOptions -> String
showsPrec :: Int -> DocumentSuggesterOptions -> ShowS
$cshowsPrec :: Int -> DocumentSuggesterOptions -> ShowS
Prelude.Show, (forall x.
DocumentSuggesterOptions -> Rep DocumentSuggesterOptions x)
-> (forall x.
Rep DocumentSuggesterOptions x -> DocumentSuggesterOptions)
-> Generic DocumentSuggesterOptions
forall x.
Rep DocumentSuggesterOptions x -> DocumentSuggesterOptions
forall x.
DocumentSuggesterOptions -> Rep DocumentSuggesterOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DocumentSuggesterOptions x -> DocumentSuggesterOptions
$cfrom :: forall x.
DocumentSuggesterOptions -> Rep DocumentSuggesterOptions x
Prelude.Generic)
newDocumentSuggesterOptions ::
Prelude.Text ->
DocumentSuggesterOptions
newDocumentSuggesterOptions :: Text -> DocumentSuggesterOptions
newDocumentSuggesterOptions Text
pSourceField_ =
DocumentSuggesterOptions' :: Maybe Text
-> Maybe SuggesterFuzzyMatching -> Text -> DocumentSuggesterOptions
DocumentSuggesterOptions'
{ $sel:sortExpression:DocumentSuggesterOptions' :: Maybe Text
sortExpression =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:fuzzyMatching:DocumentSuggesterOptions' :: Maybe SuggesterFuzzyMatching
fuzzyMatching = Maybe SuggesterFuzzyMatching
forall a. Maybe a
Prelude.Nothing,
$sel:sourceField:DocumentSuggesterOptions' :: Text
sourceField = Text
pSourceField_
}
documentSuggesterOptions_sortExpression :: Lens.Lens' DocumentSuggesterOptions (Prelude.Maybe Prelude.Text)
documentSuggesterOptions_sortExpression :: (Maybe Text -> f (Maybe Text))
-> DocumentSuggesterOptions -> f DocumentSuggesterOptions
documentSuggesterOptions_sortExpression = (DocumentSuggesterOptions -> Maybe Text)
-> (DocumentSuggesterOptions
-> Maybe Text -> DocumentSuggesterOptions)
-> Lens
DocumentSuggesterOptions
DocumentSuggesterOptions
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentSuggesterOptions' {Maybe Text
sortExpression :: Maybe Text
$sel:sortExpression:DocumentSuggesterOptions' :: DocumentSuggesterOptions -> Maybe Text
sortExpression} -> Maybe Text
sortExpression) (\s :: DocumentSuggesterOptions
s@DocumentSuggesterOptions' {} Maybe Text
a -> DocumentSuggesterOptions
s {$sel:sortExpression:DocumentSuggesterOptions' :: Maybe Text
sortExpression = Maybe Text
a} :: DocumentSuggesterOptions)
documentSuggesterOptions_fuzzyMatching :: Lens.Lens' DocumentSuggesterOptions (Prelude.Maybe SuggesterFuzzyMatching)
documentSuggesterOptions_fuzzyMatching :: (Maybe SuggesterFuzzyMatching -> f (Maybe SuggesterFuzzyMatching))
-> DocumentSuggesterOptions -> f DocumentSuggesterOptions
documentSuggesterOptions_fuzzyMatching = (DocumentSuggesterOptions -> Maybe SuggesterFuzzyMatching)
-> (DocumentSuggesterOptions
-> Maybe SuggesterFuzzyMatching -> DocumentSuggesterOptions)
-> Lens
DocumentSuggesterOptions
DocumentSuggesterOptions
(Maybe SuggesterFuzzyMatching)
(Maybe SuggesterFuzzyMatching)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentSuggesterOptions' {Maybe SuggesterFuzzyMatching
fuzzyMatching :: Maybe SuggesterFuzzyMatching
$sel:fuzzyMatching:DocumentSuggesterOptions' :: DocumentSuggesterOptions -> Maybe SuggesterFuzzyMatching
fuzzyMatching} -> Maybe SuggesterFuzzyMatching
fuzzyMatching) (\s :: DocumentSuggesterOptions
s@DocumentSuggesterOptions' {} Maybe SuggesterFuzzyMatching
a -> DocumentSuggesterOptions
s {$sel:fuzzyMatching:DocumentSuggesterOptions' :: Maybe SuggesterFuzzyMatching
fuzzyMatching = Maybe SuggesterFuzzyMatching
a} :: DocumentSuggesterOptions)
documentSuggesterOptions_sourceField :: Lens.Lens' DocumentSuggesterOptions Prelude.Text
documentSuggesterOptions_sourceField :: (Text -> f Text)
-> DocumentSuggesterOptions -> f DocumentSuggesterOptions
documentSuggesterOptions_sourceField = (DocumentSuggesterOptions -> Text)
-> (DocumentSuggesterOptions -> Text -> DocumentSuggesterOptions)
-> Lens DocumentSuggesterOptions DocumentSuggesterOptions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DocumentSuggesterOptions' {Text
sourceField :: Text
$sel:sourceField:DocumentSuggesterOptions' :: DocumentSuggesterOptions -> Text
sourceField} -> Text
sourceField) (\s :: DocumentSuggesterOptions
s@DocumentSuggesterOptions' {} Text
a -> DocumentSuggesterOptions
s {$sel:sourceField:DocumentSuggesterOptions' :: Text
sourceField = Text
a} :: DocumentSuggesterOptions)
instance Core.FromXML DocumentSuggesterOptions where
parseXML :: [Node] -> Either String DocumentSuggesterOptions
parseXML [Node]
x =
Maybe Text
-> Maybe SuggesterFuzzyMatching -> Text -> DocumentSuggesterOptions
DocumentSuggesterOptions'
(Maybe Text
-> Maybe SuggesterFuzzyMatching
-> Text
-> DocumentSuggesterOptions)
-> Either String (Maybe Text)
-> Either
String
(Maybe SuggesterFuzzyMatching -> Text -> DocumentSuggesterOptions)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SortExpression")
Either
String
(Maybe SuggesterFuzzyMatching -> Text -> DocumentSuggesterOptions)
-> Either String (Maybe SuggesterFuzzyMatching)
-> Either String (Text -> DocumentSuggesterOptions)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe SuggesterFuzzyMatching)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"FuzzyMatching")
Either String (Text -> DocumentSuggesterOptions)
-> Either String Text -> Either String DocumentSuggesterOptions
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"SourceField")
instance Prelude.Hashable DocumentSuggesterOptions
instance Prelude.NFData DocumentSuggesterOptions
instance Core.ToQuery DocumentSuggesterOptions where
toQuery :: DocumentSuggesterOptions -> QueryString
toQuery DocumentSuggesterOptions' {Maybe Text
Maybe SuggesterFuzzyMatching
Text
sourceField :: Text
fuzzyMatching :: Maybe SuggesterFuzzyMatching
sortExpression :: Maybe Text
$sel:sourceField:DocumentSuggesterOptions' :: DocumentSuggesterOptions -> Text
$sel:fuzzyMatching:DocumentSuggesterOptions' :: DocumentSuggesterOptions -> Maybe SuggesterFuzzyMatching
$sel:sortExpression:DocumentSuggesterOptions' :: DocumentSuggesterOptions -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"SortExpression" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
sortExpression,
ByteString
"FuzzyMatching" ByteString -> Maybe SuggesterFuzzyMatching -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe SuggesterFuzzyMatching
fuzzyMatching,
ByteString
"SourceField" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
sourceField
]