{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Kendra.Types.QueryResultItem
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Kendra.Types.QueryResultItem where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Kendra.Types.AdditionalResultAttribute
import Amazonka.Kendra.Types.DocumentAttribute
import Amazonka.Kendra.Types.QueryResultFormat
import Amazonka.Kendra.Types.QueryResultType
import Amazonka.Kendra.Types.ScoreAttributes
import Amazonka.Kendra.Types.TableExcerpt
import Amazonka.Kendra.Types.TextWithHighlights
import qualified Amazonka.Prelude as Prelude

-- | A single query result.
--
-- A query result contains information about a document returned by the
-- query. This includes the original location of the document, a list of
-- attributes assigned to the document, and relevant text from the document
-- that satisfies the query.
--
-- /See:/ 'newQueryResultItem' smart constructor.
data QueryResultItem = QueryResultItem'
  { -- | One or more additional attributes associated with the query result.
    QueryResultItem -> Maybe [AdditionalResultAttribute]
additionalAttributes :: Prelude.Maybe [AdditionalResultAttribute],
    -- | An array of document attributes assigned to a document in the search
    -- results. For example, the document author (@_author@) or the source URI
    -- (@_source_uri@) of the document.
    QueryResultItem -> Maybe [DocumentAttribute]
documentAttributes :: Prelude.Maybe [DocumentAttribute],
    -- | An extract of the text in the document. Contains information about
    -- highlighting the relevant terms in the excerpt.
    QueryResultItem -> Maybe TextWithHighlights
documentExcerpt :: Prelude.Maybe TextWithHighlights,
    -- | The identifier for the document.
    QueryResultItem -> Maybe Text
documentId :: Prelude.Maybe Prelude.Text,
    -- | The title of the document. Contains the text of the title and
    -- information for highlighting the relevant terms in the title.
    QueryResultItem -> Maybe TextWithHighlights
documentTitle :: Prelude.Maybe TextWithHighlights,
    -- | The URI of the original location of the document.
    QueryResultItem -> Maybe Text
documentURI :: Prelude.Maybe Prelude.Text,
    -- | A token that identifies a particular result from a particular query. Use
    -- this token to provide click-through feedback for the result. For more
    -- information, see
    -- <https://docs.aws.amazon.com/kendra/latest/dg/submitting-feedback.html Submitting feedback>
    -- .
    QueryResultItem -> Maybe Text
feedbackToken :: Prelude.Maybe Prelude.Text,
    -- | If the @Type@ of document within the response is @ANSWER@, then it is
    -- either a @TABLE@ answer or @TEXT@ answer. If it\'s a table answer, a
    -- table excerpt is returned in @TableExcerpt@. If it\'s a text answer, a
    -- text excerpt is returned in @DocumentExcerpt@.
    QueryResultItem -> Maybe QueryResultFormat
format :: Prelude.Maybe QueryResultFormat,
    -- | The identifier for the query result.
    QueryResultItem -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | Indicates the confidence that Amazon Kendra has that a result matches
    -- the query that you provided. Each result is placed into a bin that
    -- indicates the confidence, @VERY_HIGH@, @HIGH@, @MEDIUM@ and @LOW@. You
    -- can use the score to determine if a response meets the confidence needed
    -- for your application.
    --
    -- The field is only set to @LOW@ when the @Type@ field is set to
    -- @DOCUMENT@ and Amazon Kendra is not confident that the result matches
    -- the query.
    QueryResultItem -> Maybe ScoreAttributes
scoreAttributes :: Prelude.Maybe ScoreAttributes,
    -- | An excerpt from a table within a document.
    QueryResultItem -> Maybe TableExcerpt
tableExcerpt :: Prelude.Maybe TableExcerpt,
    -- | The type of document within the response. For example, a response could
    -- include a question-answer that\'s relevant to the query.
    QueryResultItem -> Maybe QueryResultType
type' :: Prelude.Maybe QueryResultType
  }
  deriving (QueryResultItem -> QueryResultItem -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: QueryResultItem -> QueryResultItem -> Bool
$c/= :: QueryResultItem -> QueryResultItem -> Bool
== :: QueryResultItem -> QueryResultItem -> Bool
$c== :: QueryResultItem -> QueryResultItem -> Bool
Prelude.Eq, ReadPrec [QueryResultItem]
ReadPrec QueryResultItem
Int -> ReadS QueryResultItem
ReadS [QueryResultItem]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [QueryResultItem]
$creadListPrec :: ReadPrec [QueryResultItem]
readPrec :: ReadPrec QueryResultItem
$creadPrec :: ReadPrec QueryResultItem
readList :: ReadS [QueryResultItem]
$creadList :: ReadS [QueryResultItem]
readsPrec :: Int -> ReadS QueryResultItem
$creadsPrec :: Int -> ReadS QueryResultItem
Prelude.Read, Int -> QueryResultItem -> ShowS
[QueryResultItem] -> ShowS
QueryResultItem -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [QueryResultItem] -> ShowS
$cshowList :: [QueryResultItem] -> ShowS
show :: QueryResultItem -> String
$cshow :: QueryResultItem -> String
showsPrec :: Int -> QueryResultItem -> ShowS
$cshowsPrec :: Int -> QueryResultItem -> ShowS
Prelude.Show, forall x. Rep QueryResultItem x -> QueryResultItem
forall x. QueryResultItem -> Rep QueryResultItem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep QueryResultItem x -> QueryResultItem
$cfrom :: forall x. QueryResultItem -> Rep QueryResultItem x
Prelude.Generic)

-- |
-- Create a value of 'QueryResultItem' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'additionalAttributes', 'queryResultItem_additionalAttributes' - One or more additional attributes associated with the query result.
--
-- 'documentAttributes', 'queryResultItem_documentAttributes' - An array of document attributes assigned to a document in the search
-- results. For example, the document author (@_author@) or the source URI
-- (@_source_uri@) of the document.
--
-- 'documentExcerpt', 'queryResultItem_documentExcerpt' - An extract of the text in the document. Contains information about
-- highlighting the relevant terms in the excerpt.
--
-- 'documentId', 'queryResultItem_documentId' - The identifier for the document.
--
-- 'documentTitle', 'queryResultItem_documentTitle' - The title of the document. Contains the text of the title and
-- information for highlighting the relevant terms in the title.
--
-- 'documentURI', 'queryResultItem_documentURI' - The URI of the original location of the document.
--
-- 'feedbackToken', 'queryResultItem_feedbackToken' - A token that identifies a particular result from a particular query. Use
-- this token to provide click-through feedback for the result. For more
-- information, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/submitting-feedback.html Submitting feedback>
-- .
--
-- 'format', 'queryResultItem_format' - If the @Type@ of document within the response is @ANSWER@, then it is
-- either a @TABLE@ answer or @TEXT@ answer. If it\'s a table answer, a
-- table excerpt is returned in @TableExcerpt@. If it\'s a text answer, a
-- text excerpt is returned in @DocumentExcerpt@.
--
-- 'id', 'queryResultItem_id' - The identifier for the query result.
--
-- 'scoreAttributes', 'queryResultItem_scoreAttributes' - Indicates the confidence that Amazon Kendra has that a result matches
-- the query that you provided. Each result is placed into a bin that
-- indicates the confidence, @VERY_HIGH@, @HIGH@, @MEDIUM@ and @LOW@. You
-- can use the score to determine if a response meets the confidence needed
-- for your application.
--
-- The field is only set to @LOW@ when the @Type@ field is set to
-- @DOCUMENT@ and Amazon Kendra is not confident that the result matches
-- the query.
--
-- 'tableExcerpt', 'queryResultItem_tableExcerpt' - An excerpt from a table within a document.
--
-- 'type'', 'queryResultItem_type' - The type of document within the response. For example, a response could
-- include a question-answer that\'s relevant to the query.
newQueryResultItem ::
  QueryResultItem
newQueryResultItem :: QueryResultItem
newQueryResultItem =
  QueryResultItem'
    { $sel:additionalAttributes:QueryResultItem' :: Maybe [AdditionalResultAttribute]
additionalAttributes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:documentAttributes:QueryResultItem' :: Maybe [DocumentAttribute]
documentAttributes = forall a. Maybe a
Prelude.Nothing,
      $sel:documentExcerpt:QueryResultItem' :: Maybe TextWithHighlights
documentExcerpt = forall a. Maybe a
Prelude.Nothing,
      $sel:documentId:QueryResultItem' :: Maybe Text
documentId = forall a. Maybe a
Prelude.Nothing,
      $sel:documentTitle:QueryResultItem' :: Maybe TextWithHighlights
documentTitle = forall a. Maybe a
Prelude.Nothing,
      $sel:documentURI:QueryResultItem' :: Maybe Text
documentURI = forall a. Maybe a
Prelude.Nothing,
      $sel:feedbackToken:QueryResultItem' :: Maybe Text
feedbackToken = forall a. Maybe a
Prelude.Nothing,
      $sel:format:QueryResultItem' :: Maybe QueryResultFormat
format = forall a. Maybe a
Prelude.Nothing,
      $sel:id:QueryResultItem' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:scoreAttributes:QueryResultItem' :: Maybe ScoreAttributes
scoreAttributes = forall a. Maybe a
Prelude.Nothing,
      $sel:tableExcerpt:QueryResultItem' :: Maybe TableExcerpt
tableExcerpt = forall a. Maybe a
Prelude.Nothing,
      $sel:type':QueryResultItem' :: Maybe QueryResultType
type' = forall a. Maybe a
Prelude.Nothing
    }

-- | One or more additional attributes associated with the query result.
queryResultItem_additionalAttributes :: Lens.Lens' QueryResultItem (Prelude.Maybe [AdditionalResultAttribute])
queryResultItem_additionalAttributes :: Lens' QueryResultItem (Maybe [AdditionalResultAttribute])
queryResultItem_additionalAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe [AdditionalResultAttribute]
additionalAttributes :: Maybe [AdditionalResultAttribute]
$sel:additionalAttributes:QueryResultItem' :: QueryResultItem -> Maybe [AdditionalResultAttribute]
additionalAttributes} -> Maybe [AdditionalResultAttribute]
additionalAttributes) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe [AdditionalResultAttribute]
a -> QueryResultItem
s {$sel:additionalAttributes:QueryResultItem' :: Maybe [AdditionalResultAttribute]
additionalAttributes = Maybe [AdditionalResultAttribute]
a} :: QueryResultItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An array of document attributes assigned to a document in the search
-- results. For example, the document author (@_author@) or the source URI
-- (@_source_uri@) of the document.
queryResultItem_documentAttributes :: Lens.Lens' QueryResultItem (Prelude.Maybe [DocumentAttribute])
queryResultItem_documentAttributes :: Lens' QueryResultItem (Maybe [DocumentAttribute])
queryResultItem_documentAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe [DocumentAttribute]
documentAttributes :: Maybe [DocumentAttribute]
$sel:documentAttributes:QueryResultItem' :: QueryResultItem -> Maybe [DocumentAttribute]
documentAttributes} -> Maybe [DocumentAttribute]
documentAttributes) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe [DocumentAttribute]
a -> QueryResultItem
s {$sel:documentAttributes:QueryResultItem' :: Maybe [DocumentAttribute]
documentAttributes = Maybe [DocumentAttribute]
a} :: QueryResultItem) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An extract of the text in the document. Contains information about
-- highlighting the relevant terms in the excerpt.
queryResultItem_documentExcerpt :: Lens.Lens' QueryResultItem (Prelude.Maybe TextWithHighlights)
queryResultItem_documentExcerpt :: Lens' QueryResultItem (Maybe TextWithHighlights)
queryResultItem_documentExcerpt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe TextWithHighlights
documentExcerpt :: Maybe TextWithHighlights
$sel:documentExcerpt:QueryResultItem' :: QueryResultItem -> Maybe TextWithHighlights
documentExcerpt} -> Maybe TextWithHighlights
documentExcerpt) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe TextWithHighlights
a -> QueryResultItem
s {$sel:documentExcerpt:QueryResultItem' :: Maybe TextWithHighlights
documentExcerpt = Maybe TextWithHighlights
a} :: QueryResultItem)

-- | The identifier for the document.
queryResultItem_documentId :: Lens.Lens' QueryResultItem (Prelude.Maybe Prelude.Text)
queryResultItem_documentId :: Lens' QueryResultItem (Maybe Text)
queryResultItem_documentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe Text
documentId :: Maybe Text
$sel:documentId:QueryResultItem' :: QueryResultItem -> Maybe Text
documentId} -> Maybe Text
documentId) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe Text
a -> QueryResultItem
s {$sel:documentId:QueryResultItem' :: Maybe Text
documentId = Maybe Text
a} :: QueryResultItem)

-- | The title of the document. Contains the text of the title and
-- information for highlighting the relevant terms in the title.
queryResultItem_documentTitle :: Lens.Lens' QueryResultItem (Prelude.Maybe TextWithHighlights)
queryResultItem_documentTitle :: Lens' QueryResultItem (Maybe TextWithHighlights)
queryResultItem_documentTitle = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe TextWithHighlights
documentTitle :: Maybe TextWithHighlights
$sel:documentTitle:QueryResultItem' :: QueryResultItem -> Maybe TextWithHighlights
documentTitle} -> Maybe TextWithHighlights
documentTitle) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe TextWithHighlights
a -> QueryResultItem
s {$sel:documentTitle:QueryResultItem' :: Maybe TextWithHighlights
documentTitle = Maybe TextWithHighlights
a} :: QueryResultItem)

-- | The URI of the original location of the document.
queryResultItem_documentURI :: Lens.Lens' QueryResultItem (Prelude.Maybe Prelude.Text)
queryResultItem_documentURI :: Lens' QueryResultItem (Maybe Text)
queryResultItem_documentURI = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe Text
documentURI :: Maybe Text
$sel:documentURI:QueryResultItem' :: QueryResultItem -> Maybe Text
documentURI} -> Maybe Text
documentURI) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe Text
a -> QueryResultItem
s {$sel:documentURI:QueryResultItem' :: Maybe Text
documentURI = Maybe Text
a} :: QueryResultItem)

-- | A token that identifies a particular result from a particular query. Use
-- this token to provide click-through feedback for the result. For more
-- information, see
-- <https://docs.aws.amazon.com/kendra/latest/dg/submitting-feedback.html Submitting feedback>
-- .
queryResultItem_feedbackToken :: Lens.Lens' QueryResultItem (Prelude.Maybe Prelude.Text)
queryResultItem_feedbackToken :: Lens' QueryResultItem (Maybe Text)
queryResultItem_feedbackToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe Text
feedbackToken :: Maybe Text
$sel:feedbackToken:QueryResultItem' :: QueryResultItem -> Maybe Text
feedbackToken} -> Maybe Text
feedbackToken) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe Text
a -> QueryResultItem
s {$sel:feedbackToken:QueryResultItem' :: Maybe Text
feedbackToken = Maybe Text
a} :: QueryResultItem)

-- | If the @Type@ of document within the response is @ANSWER@, then it is
-- either a @TABLE@ answer or @TEXT@ answer. If it\'s a table answer, a
-- table excerpt is returned in @TableExcerpt@. If it\'s a text answer, a
-- text excerpt is returned in @DocumentExcerpt@.
queryResultItem_format :: Lens.Lens' QueryResultItem (Prelude.Maybe QueryResultFormat)
queryResultItem_format :: Lens' QueryResultItem (Maybe QueryResultFormat)
queryResultItem_format = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe QueryResultFormat
format :: Maybe QueryResultFormat
$sel:format:QueryResultItem' :: QueryResultItem -> Maybe QueryResultFormat
format} -> Maybe QueryResultFormat
format) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe QueryResultFormat
a -> QueryResultItem
s {$sel:format:QueryResultItem' :: Maybe QueryResultFormat
format = Maybe QueryResultFormat
a} :: QueryResultItem)

-- | The identifier for the query result.
queryResultItem_id :: Lens.Lens' QueryResultItem (Prelude.Maybe Prelude.Text)
queryResultItem_id :: Lens' QueryResultItem (Maybe Text)
queryResultItem_id = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe Text
id :: Maybe Text
$sel:id:QueryResultItem' :: QueryResultItem -> Maybe Text
id} -> Maybe Text
id) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe Text
a -> QueryResultItem
s {$sel:id:QueryResultItem' :: Maybe Text
id = Maybe Text
a} :: QueryResultItem)

-- | Indicates the confidence that Amazon Kendra has that a result matches
-- the query that you provided. Each result is placed into a bin that
-- indicates the confidence, @VERY_HIGH@, @HIGH@, @MEDIUM@ and @LOW@. You
-- can use the score to determine if a response meets the confidence needed
-- for your application.
--
-- The field is only set to @LOW@ when the @Type@ field is set to
-- @DOCUMENT@ and Amazon Kendra is not confident that the result matches
-- the query.
queryResultItem_scoreAttributes :: Lens.Lens' QueryResultItem (Prelude.Maybe ScoreAttributes)
queryResultItem_scoreAttributes :: Lens' QueryResultItem (Maybe ScoreAttributes)
queryResultItem_scoreAttributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe ScoreAttributes
scoreAttributes :: Maybe ScoreAttributes
$sel:scoreAttributes:QueryResultItem' :: QueryResultItem -> Maybe ScoreAttributes
scoreAttributes} -> Maybe ScoreAttributes
scoreAttributes) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe ScoreAttributes
a -> QueryResultItem
s {$sel:scoreAttributes:QueryResultItem' :: Maybe ScoreAttributes
scoreAttributes = Maybe ScoreAttributes
a} :: QueryResultItem)

-- | An excerpt from a table within a document.
queryResultItem_tableExcerpt :: Lens.Lens' QueryResultItem (Prelude.Maybe TableExcerpt)
queryResultItem_tableExcerpt :: Lens' QueryResultItem (Maybe TableExcerpt)
queryResultItem_tableExcerpt = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe TableExcerpt
tableExcerpt :: Maybe TableExcerpt
$sel:tableExcerpt:QueryResultItem' :: QueryResultItem -> Maybe TableExcerpt
tableExcerpt} -> Maybe TableExcerpt
tableExcerpt) (\s :: QueryResultItem
s@QueryResultItem' {} Maybe TableExcerpt
a -> QueryResultItem
s {$sel:tableExcerpt:QueryResultItem' :: Maybe TableExcerpt
tableExcerpt = Maybe TableExcerpt
a} :: QueryResultItem)

-- | The type of document within the response. For example, a response could
-- include a question-answer that\'s relevant to the query.
queryResultItem_type :: Lens.Lens' QueryResultItem (Prelude.Maybe QueryResultType)
queryResultItem_type :: Lens' QueryResultItem (Maybe QueryResultType)
queryResultItem_type = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\QueryResultItem' {Maybe QueryResultType
type' :: Maybe QueryResultType
$sel:type':QueryResultItem' :: QueryResultItem -> Maybe QueryResultType
type'} -> Maybe QueryResultType
type') (\s :: QueryResultItem
s@QueryResultItem' {} Maybe QueryResultType
a -> QueryResultItem
s {$sel:type':QueryResultItem' :: Maybe QueryResultType
type' = Maybe QueryResultType
a} :: QueryResultItem)

instance Data.FromJSON QueryResultItem where
  parseJSON :: Value -> Parser QueryResultItem
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"QueryResultItem"
      ( \Object
x ->
          Maybe [AdditionalResultAttribute]
-> Maybe [DocumentAttribute]
-> Maybe TextWithHighlights
-> Maybe Text
-> Maybe TextWithHighlights
-> Maybe Text
-> Maybe Text
-> Maybe QueryResultFormat
-> Maybe Text
-> Maybe ScoreAttributes
-> Maybe TableExcerpt
-> Maybe QueryResultType
-> QueryResultItem
QueryResultItem'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"AdditionalAttributes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x
                            forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DocumentAttributes"
                            forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty
                        )
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DocumentExcerpt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DocumentId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DocumentTitle")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"DocumentURI")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"FeedbackToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Format")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Id")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"ScoreAttributes")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"TableExcerpt")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Type")
      )

instance Prelude.Hashable QueryResultItem where
  hashWithSalt :: Int -> QueryResultItem -> Int
hashWithSalt Int
_salt QueryResultItem' {Maybe [DocumentAttribute]
Maybe [AdditionalResultAttribute]
Maybe Text
Maybe QueryResultFormat
Maybe QueryResultType
Maybe ScoreAttributes
Maybe TableExcerpt
Maybe TextWithHighlights
type' :: Maybe QueryResultType
tableExcerpt :: Maybe TableExcerpt
scoreAttributes :: Maybe ScoreAttributes
id :: Maybe Text
format :: Maybe QueryResultFormat
feedbackToken :: Maybe Text
documentURI :: Maybe Text
documentTitle :: Maybe TextWithHighlights
documentId :: Maybe Text
documentExcerpt :: Maybe TextWithHighlights
documentAttributes :: Maybe [DocumentAttribute]
additionalAttributes :: Maybe [AdditionalResultAttribute]
$sel:type':QueryResultItem' :: QueryResultItem -> Maybe QueryResultType
$sel:tableExcerpt:QueryResultItem' :: QueryResultItem -> Maybe TableExcerpt
$sel:scoreAttributes:QueryResultItem' :: QueryResultItem -> Maybe ScoreAttributes
$sel:id:QueryResultItem' :: QueryResultItem -> Maybe Text
$sel:format:QueryResultItem' :: QueryResultItem -> Maybe QueryResultFormat
$sel:feedbackToken:QueryResultItem' :: QueryResultItem -> Maybe Text
$sel:documentURI:QueryResultItem' :: QueryResultItem -> Maybe Text
$sel:documentTitle:QueryResultItem' :: QueryResultItem -> Maybe TextWithHighlights
$sel:documentId:QueryResultItem' :: QueryResultItem -> Maybe Text
$sel:documentExcerpt:QueryResultItem' :: QueryResultItem -> Maybe TextWithHighlights
$sel:documentAttributes:QueryResultItem' :: QueryResultItem -> Maybe [DocumentAttribute]
$sel:additionalAttributes:QueryResultItem' :: QueryResultItem -> Maybe [AdditionalResultAttribute]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AdditionalResultAttribute]
additionalAttributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DocumentAttribute]
documentAttributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TextWithHighlights
documentExcerpt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
documentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TextWithHighlights
documentTitle
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
documentURI
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
feedbackToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe QueryResultFormat
format
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ScoreAttributes
scoreAttributes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe TableExcerpt
tableExcerpt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe QueryResultType
type'

instance Prelude.NFData QueryResultItem where
  rnf :: QueryResultItem -> ()
rnf QueryResultItem' {Maybe [DocumentAttribute]
Maybe [AdditionalResultAttribute]
Maybe Text
Maybe QueryResultFormat
Maybe QueryResultType
Maybe ScoreAttributes
Maybe TableExcerpt
Maybe TextWithHighlights
type' :: Maybe QueryResultType
tableExcerpt :: Maybe TableExcerpt
scoreAttributes :: Maybe ScoreAttributes
id :: Maybe Text
format :: Maybe QueryResultFormat
feedbackToken :: Maybe Text
documentURI :: Maybe Text
documentTitle :: Maybe TextWithHighlights
documentId :: Maybe Text
documentExcerpt :: Maybe TextWithHighlights
documentAttributes :: Maybe [DocumentAttribute]
additionalAttributes :: Maybe [AdditionalResultAttribute]
$sel:type':QueryResultItem' :: QueryResultItem -> Maybe QueryResultType
$sel:tableExcerpt:QueryResultItem' :: QueryResultItem -> Maybe TableExcerpt
$sel:scoreAttributes:QueryResultItem' :: QueryResultItem -> Maybe ScoreAttributes
$sel:id:QueryResultItem' :: QueryResultItem -> Maybe Text
$sel:format:QueryResultItem' :: QueryResultItem -> Maybe QueryResultFormat
$sel:feedbackToken:QueryResultItem' :: QueryResultItem -> Maybe Text
$sel:documentURI:QueryResultItem' :: QueryResultItem -> Maybe Text
$sel:documentTitle:QueryResultItem' :: QueryResultItem -> Maybe TextWithHighlights
$sel:documentId:QueryResultItem' :: QueryResultItem -> Maybe Text
$sel:documentExcerpt:QueryResultItem' :: QueryResultItem -> Maybe TextWithHighlights
$sel:documentAttributes:QueryResultItem' :: QueryResultItem -> Maybe [DocumentAttribute]
$sel:additionalAttributes:QueryResultItem' :: QueryResultItem -> Maybe [AdditionalResultAttribute]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AdditionalResultAttribute]
additionalAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DocumentAttribute]
documentAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TextWithHighlights
documentExcerpt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TextWithHighlights
documentTitle
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
documentURI
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
feedbackToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe QueryResultFormat
format
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ScoreAttributes
scoreAttributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe TableExcerpt
tableExcerpt
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe QueryResultType
type'