{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}

module Database.Redis.ManualCommands.FT where

import Data.ByteString (ByteString)
import Data.List.NonEmpty (NonEmpty(..))
import qualified Data.List.NonEmpty as NE

import Database.Redis.Core
import Database.Redis.ManualCommands (GeoUnit(..), SortOrder(..))
import Database.Redis.Protocol
import Database.Redis.Types

data FTOn
    = FTOnHash
    | FTOnJson
    deriving (Int -> FTOn -> ShowS
[FTOn] -> ShowS
FTOn -> String
(Int -> FTOn -> ShowS)
-> (FTOn -> String) -> ([FTOn] -> ShowS) -> Show FTOn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTOn -> ShowS
showsPrec :: Int -> FTOn -> ShowS
$cshow :: FTOn -> String
show :: FTOn -> String
$cshowList :: [FTOn] -> ShowS
showList :: [FTOn] -> ShowS
Show, FTOn -> FTOn -> Bool
(FTOn -> FTOn -> Bool) -> (FTOn -> FTOn -> Bool) -> Eq FTOn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTOn -> FTOn -> Bool
== :: FTOn -> FTOn -> Bool
$c/= :: FTOn -> FTOn -> Bool
/= :: FTOn -> FTOn -> Bool
Eq)

instance RedisArg FTOn where
    encode :: FTOn -> ByteString
encode FTOn
FTOnHash = ByteString
"HASH"
    encode FTOn
FTOnJson = ByteString
"JSON"

data FTIndexAllMode
    = FTIndexAllEnable
    | FTIndexAllDisable
    deriving (Int -> FTIndexAllMode -> ShowS
[FTIndexAllMode] -> ShowS
FTIndexAllMode -> String
(Int -> FTIndexAllMode -> ShowS)
-> (FTIndexAllMode -> String)
-> ([FTIndexAllMode] -> ShowS)
-> Show FTIndexAllMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTIndexAllMode -> ShowS
showsPrec :: Int -> FTIndexAllMode -> ShowS
$cshow :: FTIndexAllMode -> String
show :: FTIndexAllMode -> String
$cshowList :: [FTIndexAllMode] -> ShowS
showList :: [FTIndexAllMode] -> ShowS
Show, FTIndexAllMode -> FTIndexAllMode -> Bool
(FTIndexAllMode -> FTIndexAllMode -> Bool)
-> (FTIndexAllMode -> FTIndexAllMode -> Bool) -> Eq FTIndexAllMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTIndexAllMode -> FTIndexAllMode -> Bool
== :: FTIndexAllMode -> FTIndexAllMode -> Bool
$c/= :: FTIndexAllMode -> FTIndexAllMode -> Bool
/= :: FTIndexAllMode -> FTIndexAllMode -> Bool
Eq)

instance RedisArg FTIndexAllMode where
    encode :: FTIndexAllMode -> ByteString
encode FTIndexAllMode
FTIndexAllEnable = ByteString
"ENABLE"
    encode FTIndexAllMode
FTIndexAllDisable = ByteString
"DISABLE"

data FTFieldIdentifier
    = FTFieldName ByteString
    | FTFieldNameAs ByteString ByteString
    deriving (Int -> FTFieldIdentifier -> ShowS
[FTFieldIdentifier] -> ShowS
FTFieldIdentifier -> String
(Int -> FTFieldIdentifier -> ShowS)
-> (FTFieldIdentifier -> String)
-> ([FTFieldIdentifier] -> ShowS)
-> Show FTFieldIdentifier
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTFieldIdentifier -> ShowS
showsPrec :: Int -> FTFieldIdentifier -> ShowS
$cshow :: FTFieldIdentifier -> String
show :: FTFieldIdentifier -> String
$cshowList :: [FTFieldIdentifier] -> ShowS
showList :: [FTFieldIdentifier] -> ShowS
Show, FTFieldIdentifier -> FTFieldIdentifier -> Bool
(FTFieldIdentifier -> FTFieldIdentifier -> Bool)
-> (FTFieldIdentifier -> FTFieldIdentifier -> Bool)
-> Eq FTFieldIdentifier
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTFieldIdentifier -> FTFieldIdentifier -> Bool
== :: FTFieldIdentifier -> FTFieldIdentifier -> Bool
$c/= :: FTFieldIdentifier -> FTFieldIdentifier -> Bool
/= :: FTFieldIdentifier -> FTFieldIdentifier -> Bool
Eq)

data FTSortable
    = FTSortable
    | FTSortableUnf
    deriving (Int -> FTSortable -> ShowS
[FTSortable] -> ShowS
FTSortable -> String
(Int -> FTSortable -> ShowS)
-> (FTSortable -> String)
-> ([FTSortable] -> ShowS)
-> Show FTSortable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSortable -> ShowS
showsPrec :: Int -> FTSortable -> ShowS
$cshow :: FTSortable -> String
show :: FTSortable -> String
$cshowList :: [FTSortable] -> ShowS
showList :: [FTSortable] -> ShowS
Show, FTSortable -> FTSortable -> Bool
(FTSortable -> FTSortable -> Bool)
-> (FTSortable -> FTSortable -> Bool) -> Eq FTSortable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSortable -> FTSortable -> Bool
== :: FTSortable -> FTSortable -> Bool
$c/= :: FTSortable -> FTSortable -> Bool
/= :: FTSortable -> FTSortable -> Bool
Eq)

data FTCommonFieldOpts = FTCommonFieldOpts
    { FTCommonFieldOpts -> Bool
ftCommonFieldWithSuffixTrie :: Bool
    , FTCommonFieldOpts -> Bool
ftCommonFieldIndexEmpty :: Bool
    , FTCommonFieldOpts -> Bool
ftCommonFieldIndexMissing :: Bool
    , FTCommonFieldOpts -> Maybe FTSortable
ftCommonFieldSortable :: Maybe FTSortable
    , FTCommonFieldOpts -> Bool
ftCommonFieldNoIndex :: Bool
    } deriving (Int -> FTCommonFieldOpts -> ShowS
[FTCommonFieldOpts] -> ShowS
FTCommonFieldOpts -> String
(Int -> FTCommonFieldOpts -> ShowS)
-> (FTCommonFieldOpts -> String)
-> ([FTCommonFieldOpts] -> ShowS)
-> Show FTCommonFieldOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTCommonFieldOpts -> ShowS
showsPrec :: Int -> FTCommonFieldOpts -> ShowS
$cshow :: FTCommonFieldOpts -> String
show :: FTCommonFieldOpts -> String
$cshowList :: [FTCommonFieldOpts] -> ShowS
showList :: [FTCommonFieldOpts] -> ShowS
Show, FTCommonFieldOpts -> FTCommonFieldOpts -> Bool
(FTCommonFieldOpts -> FTCommonFieldOpts -> Bool)
-> (FTCommonFieldOpts -> FTCommonFieldOpts -> Bool)
-> Eq FTCommonFieldOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTCommonFieldOpts -> FTCommonFieldOpts -> Bool
== :: FTCommonFieldOpts -> FTCommonFieldOpts -> Bool
$c/= :: FTCommonFieldOpts -> FTCommonFieldOpts -> Bool
/= :: FTCommonFieldOpts -> FTCommonFieldOpts -> Bool
Eq)

defaultFTCommonFieldOpts :: FTCommonFieldOpts
defaultFTCommonFieldOpts :: FTCommonFieldOpts
defaultFTCommonFieldOpts = FTCommonFieldOpts
    { ftCommonFieldWithSuffixTrie :: Bool
ftCommonFieldWithSuffixTrie = Bool
False
    , ftCommonFieldIndexEmpty :: Bool
ftCommonFieldIndexEmpty = Bool
False
    , ftCommonFieldIndexMissing :: Bool
ftCommonFieldIndexMissing = Bool
False
    , ftCommonFieldSortable :: Maybe FTSortable
ftCommonFieldSortable = Maybe FTSortable
forall a. Maybe a
Nothing
    , ftCommonFieldNoIndex :: Bool
ftCommonFieldNoIndex = Bool
False
    }

data FTTextFieldOpts = FTTextFieldOpts
    { FTTextFieldOpts -> Maybe Double
ftTextFieldWeight :: Maybe Double
    , FTTextFieldOpts -> Bool
ftTextFieldNoStem :: Bool
    , FTTextFieldOpts -> Maybe ByteString
ftTextFieldPhonetic :: Maybe ByteString
    , FTTextFieldOpts -> FTCommonFieldOpts
ftTextFieldCommonOpts :: FTCommonFieldOpts
    } deriving (Int -> FTTextFieldOpts -> ShowS
[FTTextFieldOpts] -> ShowS
FTTextFieldOpts -> String
(Int -> FTTextFieldOpts -> ShowS)
-> (FTTextFieldOpts -> String)
-> ([FTTextFieldOpts] -> ShowS)
-> Show FTTextFieldOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTTextFieldOpts -> ShowS
showsPrec :: Int -> FTTextFieldOpts -> ShowS
$cshow :: FTTextFieldOpts -> String
show :: FTTextFieldOpts -> String
$cshowList :: [FTTextFieldOpts] -> ShowS
showList :: [FTTextFieldOpts] -> ShowS
Show, FTTextFieldOpts -> FTTextFieldOpts -> Bool
(FTTextFieldOpts -> FTTextFieldOpts -> Bool)
-> (FTTextFieldOpts -> FTTextFieldOpts -> Bool)
-> Eq FTTextFieldOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTTextFieldOpts -> FTTextFieldOpts -> Bool
== :: FTTextFieldOpts -> FTTextFieldOpts -> Bool
$c/= :: FTTextFieldOpts -> FTTextFieldOpts -> Bool
/= :: FTTextFieldOpts -> FTTextFieldOpts -> Bool
Eq)

defaultFTTextFieldOpts :: FTTextFieldOpts
defaultFTTextFieldOpts :: FTTextFieldOpts
defaultFTTextFieldOpts = FTTextFieldOpts
    { ftTextFieldWeight :: Maybe Double
ftTextFieldWeight = Maybe Double
forall a. Maybe a
Nothing
    , ftTextFieldNoStem :: Bool
ftTextFieldNoStem = Bool
False
    , ftTextFieldPhonetic :: Maybe ByteString
ftTextFieldPhonetic = Maybe ByteString
forall a. Maybe a
Nothing
    , ftTextFieldCommonOpts :: FTCommonFieldOpts
ftTextFieldCommonOpts = FTCommonFieldOpts
defaultFTCommonFieldOpts
    }

data FTTagFieldOpts = FTTagFieldOpts
    { FTTagFieldOpts -> Maybe ByteString
ftTagFieldSeparator :: Maybe ByteString
    , FTTagFieldOpts -> Bool
ftTagFieldCaseSensitive :: Bool
    , FTTagFieldOpts -> FTCommonFieldOpts
ftTagFieldCommonOpts :: FTCommonFieldOpts
    } deriving (Int -> FTTagFieldOpts -> ShowS
[FTTagFieldOpts] -> ShowS
FTTagFieldOpts -> String
(Int -> FTTagFieldOpts -> ShowS)
-> (FTTagFieldOpts -> String)
-> ([FTTagFieldOpts] -> ShowS)
-> Show FTTagFieldOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTTagFieldOpts -> ShowS
showsPrec :: Int -> FTTagFieldOpts -> ShowS
$cshow :: FTTagFieldOpts -> String
show :: FTTagFieldOpts -> String
$cshowList :: [FTTagFieldOpts] -> ShowS
showList :: [FTTagFieldOpts] -> ShowS
Show, FTTagFieldOpts -> FTTagFieldOpts -> Bool
(FTTagFieldOpts -> FTTagFieldOpts -> Bool)
-> (FTTagFieldOpts -> FTTagFieldOpts -> Bool) -> Eq FTTagFieldOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTTagFieldOpts -> FTTagFieldOpts -> Bool
== :: FTTagFieldOpts -> FTTagFieldOpts -> Bool
$c/= :: FTTagFieldOpts -> FTTagFieldOpts -> Bool
/= :: FTTagFieldOpts -> FTTagFieldOpts -> Bool
Eq)

defaultFTTagFieldOpts :: FTTagFieldOpts
defaultFTTagFieldOpts :: FTTagFieldOpts
defaultFTTagFieldOpts = FTTagFieldOpts
    { ftTagFieldSeparator :: Maybe ByteString
ftTagFieldSeparator = Maybe ByteString
forall a. Maybe a
Nothing
    , ftTagFieldCaseSensitive :: Bool
ftTagFieldCaseSensitive = Bool
False
    , ftTagFieldCommonOpts :: FTCommonFieldOpts
ftTagFieldCommonOpts = FTCommonFieldOpts
defaultFTCommonFieldOpts
    }

data FTGeoShapeFieldOpts = FTGeoShapeFieldOpts
    { FTGeoShapeFieldOpts -> Maybe ByteString
ftGeoShapeFieldCoordSystem :: Maybe ByteString
    , FTGeoShapeFieldOpts -> FTCommonFieldOpts
ftGeoShapeFieldCommonOpts :: FTCommonFieldOpts
    } deriving (Int -> FTGeoShapeFieldOpts -> ShowS
[FTGeoShapeFieldOpts] -> ShowS
FTGeoShapeFieldOpts -> String
(Int -> FTGeoShapeFieldOpts -> ShowS)
-> (FTGeoShapeFieldOpts -> String)
-> ([FTGeoShapeFieldOpts] -> ShowS)
-> Show FTGeoShapeFieldOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTGeoShapeFieldOpts -> ShowS
showsPrec :: Int -> FTGeoShapeFieldOpts -> ShowS
$cshow :: FTGeoShapeFieldOpts -> String
show :: FTGeoShapeFieldOpts -> String
$cshowList :: [FTGeoShapeFieldOpts] -> ShowS
showList :: [FTGeoShapeFieldOpts] -> ShowS
Show, FTGeoShapeFieldOpts -> FTGeoShapeFieldOpts -> Bool
(FTGeoShapeFieldOpts -> FTGeoShapeFieldOpts -> Bool)
-> (FTGeoShapeFieldOpts -> FTGeoShapeFieldOpts -> Bool)
-> Eq FTGeoShapeFieldOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTGeoShapeFieldOpts -> FTGeoShapeFieldOpts -> Bool
== :: FTGeoShapeFieldOpts -> FTGeoShapeFieldOpts -> Bool
$c/= :: FTGeoShapeFieldOpts -> FTGeoShapeFieldOpts -> Bool
/= :: FTGeoShapeFieldOpts -> FTGeoShapeFieldOpts -> Bool
Eq)

defaultFTGeoShapeFieldOpts :: FTGeoShapeFieldOpts
defaultFTGeoShapeFieldOpts :: FTGeoShapeFieldOpts
defaultFTGeoShapeFieldOpts = FTGeoShapeFieldOpts
    { ftGeoShapeFieldCoordSystem :: Maybe ByteString
ftGeoShapeFieldCoordSystem = Maybe ByteString
forall a. Maybe a
Nothing
    , ftGeoShapeFieldCommonOpts :: FTCommonFieldOpts
ftGeoShapeFieldCommonOpts = FTCommonFieldOpts
defaultFTCommonFieldOpts
    }

data FTVectorFieldOpts = FTVectorFieldOpts
    { FTVectorFieldOpts -> ByteString
ftVectorFieldAlgorithm :: ByteString
    , FTVectorFieldOpts -> NonEmpty (ByteString, ByteString)
ftVectorFieldAttributes :: NonEmpty (ByteString, ByteString)
    , FTVectorFieldOpts -> FTCommonFieldOpts
ftVectorFieldCommonOpts :: FTCommonFieldOpts
    } deriving (Int -> FTVectorFieldOpts -> ShowS
[FTVectorFieldOpts] -> ShowS
FTVectorFieldOpts -> String
(Int -> FTVectorFieldOpts -> ShowS)
-> (FTVectorFieldOpts -> String)
-> ([FTVectorFieldOpts] -> ShowS)
-> Show FTVectorFieldOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTVectorFieldOpts -> ShowS
showsPrec :: Int -> FTVectorFieldOpts -> ShowS
$cshow :: FTVectorFieldOpts -> String
show :: FTVectorFieldOpts -> String
$cshowList :: [FTVectorFieldOpts] -> ShowS
showList :: [FTVectorFieldOpts] -> ShowS
Show, FTVectorFieldOpts -> FTVectorFieldOpts -> Bool
(FTVectorFieldOpts -> FTVectorFieldOpts -> Bool)
-> (FTVectorFieldOpts -> FTVectorFieldOpts -> Bool)
-> Eq FTVectorFieldOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTVectorFieldOpts -> FTVectorFieldOpts -> Bool
== :: FTVectorFieldOpts -> FTVectorFieldOpts -> Bool
$c/= :: FTVectorFieldOpts -> FTVectorFieldOpts -> Bool
/= :: FTVectorFieldOpts -> FTVectorFieldOpts -> Bool
Eq)

data FTCreateField
    = FTCreateTextField FTFieldIdentifier FTTextFieldOpts
    | FTCreateTagField FTFieldIdentifier FTTagFieldOpts
    | FTCreateNumericField FTFieldIdentifier FTCommonFieldOpts
    | FTCreateGeoField FTFieldIdentifier FTCommonFieldOpts
    | FTCreateGeoShapeField FTFieldIdentifier FTGeoShapeFieldOpts
    | FTCreateVectorField FTFieldIdentifier FTVectorFieldOpts
    deriving (Int -> FTCreateField -> ShowS
[FTCreateField] -> ShowS
FTCreateField -> String
(Int -> FTCreateField -> ShowS)
-> (FTCreateField -> String)
-> ([FTCreateField] -> ShowS)
-> Show FTCreateField
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTCreateField -> ShowS
showsPrec :: Int -> FTCreateField -> ShowS
$cshow :: FTCreateField -> String
show :: FTCreateField -> String
$cshowList :: [FTCreateField] -> ShowS
showList :: [FTCreateField] -> ShowS
Show, FTCreateField -> FTCreateField -> Bool
(FTCreateField -> FTCreateField -> Bool)
-> (FTCreateField -> FTCreateField -> Bool) -> Eq FTCreateField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTCreateField -> FTCreateField -> Bool
== :: FTCreateField -> FTCreateField -> Bool
$c/= :: FTCreateField -> FTCreateField -> Bool
/= :: FTCreateField -> FTCreateField -> Bool
Eq)

data FTCreateOpts = FTCreateOpts
    { FTCreateOpts -> Maybe FTOn
ftCreateOn :: Maybe FTOn
    , FTCreateOpts -> Maybe FTIndexAllMode
ftCreateIndexAll :: Maybe FTIndexAllMode
    , FTCreateOpts -> [ByteString]
ftCreatePrefixes :: [ByteString]
    , FTCreateOpts -> Maybe ByteString
ftCreateFilter :: Maybe ByteString
    , FTCreateOpts -> Maybe ByteString
ftCreateLanguage :: Maybe ByteString
    , FTCreateOpts -> Maybe ByteString
ftCreateLanguageField :: Maybe ByteString
    , FTCreateOpts -> Maybe Double
ftCreateScore :: Maybe Double
    , FTCreateOpts -> Maybe ByteString
ftCreateScoreField :: Maybe ByteString
    , FTCreateOpts -> Maybe ByteString
ftCreatePayloadField :: Maybe ByteString
    , FTCreateOpts -> Bool
ftCreateMaxTextFields :: Bool
    , FTCreateOpts -> Maybe Double
ftCreateTemporarySeconds :: Maybe Double
    , FTCreateOpts -> Bool
ftCreateNoOffsets :: Bool
    , FTCreateOpts -> Bool
ftCreateNoHl :: Bool
    , FTCreateOpts -> Bool
ftCreateNoFields :: Bool
    , FTCreateOpts -> Bool
ftCreateNoFreqs :: Bool
    , FTCreateOpts -> Maybe [ByteString]
ftCreateStopwords :: Maybe [ByteString]
    , FTCreateOpts -> Bool
ftCreateSkipInitialScan :: Bool
    } deriving (Int -> FTCreateOpts -> ShowS
[FTCreateOpts] -> ShowS
FTCreateOpts -> String
(Int -> FTCreateOpts -> ShowS)
-> (FTCreateOpts -> String)
-> ([FTCreateOpts] -> ShowS)
-> Show FTCreateOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTCreateOpts -> ShowS
showsPrec :: Int -> FTCreateOpts -> ShowS
$cshow :: FTCreateOpts -> String
show :: FTCreateOpts -> String
$cshowList :: [FTCreateOpts] -> ShowS
showList :: [FTCreateOpts] -> ShowS
Show, FTCreateOpts -> FTCreateOpts -> Bool
(FTCreateOpts -> FTCreateOpts -> Bool)
-> (FTCreateOpts -> FTCreateOpts -> Bool) -> Eq FTCreateOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTCreateOpts -> FTCreateOpts -> Bool
== :: FTCreateOpts -> FTCreateOpts -> Bool
$c/= :: FTCreateOpts -> FTCreateOpts -> Bool
/= :: FTCreateOpts -> FTCreateOpts -> Bool
Eq)

defaultFTCreateOpts :: FTCreateOpts
defaultFTCreateOpts :: FTCreateOpts
defaultFTCreateOpts = FTCreateOpts
    { ftCreateOn :: Maybe FTOn
ftCreateOn = Maybe FTOn
forall a. Maybe a
Nothing
    , ftCreateIndexAll :: Maybe FTIndexAllMode
ftCreateIndexAll = Maybe FTIndexAllMode
forall a. Maybe a
Nothing
    , ftCreatePrefixes :: [ByteString]
ftCreatePrefixes = []
    , ftCreateFilter :: Maybe ByteString
ftCreateFilter = Maybe ByteString
forall a. Maybe a
Nothing
    , ftCreateLanguage :: Maybe ByteString
ftCreateLanguage = Maybe ByteString
forall a. Maybe a
Nothing
    , ftCreateLanguageField :: Maybe ByteString
ftCreateLanguageField = Maybe ByteString
forall a. Maybe a
Nothing
    , ftCreateScore :: Maybe Double
ftCreateScore = Maybe Double
forall a. Maybe a
Nothing
    , ftCreateScoreField :: Maybe ByteString
ftCreateScoreField = Maybe ByteString
forall a. Maybe a
Nothing
    , ftCreatePayloadField :: Maybe ByteString
ftCreatePayloadField = Maybe ByteString
forall a. Maybe a
Nothing
    , ftCreateMaxTextFields :: Bool
ftCreateMaxTextFields = Bool
False
    , ftCreateTemporarySeconds :: Maybe Double
ftCreateTemporarySeconds = Maybe Double
forall a. Maybe a
Nothing
    , ftCreateNoOffsets :: Bool
ftCreateNoOffsets = Bool
False
    , ftCreateNoHl :: Bool
ftCreateNoHl = Bool
False
    , ftCreateNoFields :: Bool
ftCreateNoFields = Bool
False
    , ftCreateNoFreqs :: Bool
ftCreateNoFreqs = Bool
False
    , ftCreateStopwords :: Maybe [ByteString]
ftCreateStopwords = Maybe [ByteString]
forall a. Maybe a
Nothing
    , ftCreateSkipInitialScan :: Bool
ftCreateSkipInitialScan = Bool
False
    }

data FTAlterOpts = FTAlterOpts
    { FTAlterOpts -> Bool
ftAlterSkipInitialScan :: Bool
    } deriving (Int -> FTAlterOpts -> ShowS
[FTAlterOpts] -> ShowS
FTAlterOpts -> String
(Int -> FTAlterOpts -> ShowS)
-> (FTAlterOpts -> String)
-> ([FTAlterOpts] -> ShowS)
-> Show FTAlterOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTAlterOpts -> ShowS
showsPrec :: Int -> FTAlterOpts -> ShowS
$cshow :: FTAlterOpts -> String
show :: FTAlterOpts -> String
$cshowList :: [FTAlterOpts] -> ShowS
showList :: [FTAlterOpts] -> ShowS
Show, FTAlterOpts -> FTAlterOpts -> Bool
(FTAlterOpts -> FTAlterOpts -> Bool)
-> (FTAlterOpts -> FTAlterOpts -> Bool) -> Eq FTAlterOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTAlterOpts -> FTAlterOpts -> Bool
== :: FTAlterOpts -> FTAlterOpts -> Bool
$c/= :: FTAlterOpts -> FTAlterOpts -> Bool
/= :: FTAlterOpts -> FTAlterOpts -> Bool
Eq)

defaultFTAlterOpts :: FTAlterOpts
defaultFTAlterOpts :: FTAlterOpts
defaultFTAlterOpts = FTAlterOpts
    { ftAlterSkipInitialScan :: Bool
ftAlterSkipInitialScan = Bool
False
    }

data FTExplainOpts = FTExplainOpts
    { FTExplainOpts -> Maybe Integer
ftExplainDialect :: Maybe Integer
    } deriving (Int -> FTExplainOpts -> ShowS
[FTExplainOpts] -> ShowS
FTExplainOpts -> String
(Int -> FTExplainOpts -> ShowS)
-> (FTExplainOpts -> String)
-> ([FTExplainOpts] -> ShowS)
-> Show FTExplainOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTExplainOpts -> ShowS
showsPrec :: Int -> FTExplainOpts -> ShowS
$cshow :: FTExplainOpts -> String
show :: FTExplainOpts -> String
$cshowList :: [FTExplainOpts] -> ShowS
showList :: [FTExplainOpts] -> ShowS
Show, FTExplainOpts -> FTExplainOpts -> Bool
(FTExplainOpts -> FTExplainOpts -> Bool)
-> (FTExplainOpts -> FTExplainOpts -> Bool) -> Eq FTExplainOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTExplainOpts -> FTExplainOpts -> Bool
== :: FTExplainOpts -> FTExplainOpts -> Bool
$c/= :: FTExplainOpts -> FTExplainOpts -> Bool
/= :: FTExplainOpts -> FTExplainOpts -> Bool
Eq)

defaultFTExplainOpts :: FTExplainOpts
defaultFTExplainOpts :: FTExplainOpts
defaultFTExplainOpts = FTExplainOpts
    { ftExplainDialect :: Maybe Integer
ftExplainDialect = Maybe Integer
forall a. Maybe a
Nothing
    }

data FTSearchContentMode
    = FTSearchReturnDocuments
    | FTSearchReturnIdsOnly
    deriving (Int -> FTSearchContentMode -> ShowS
[FTSearchContentMode] -> ShowS
FTSearchContentMode -> String
(Int -> FTSearchContentMode -> ShowS)
-> (FTSearchContentMode -> String)
-> ([FTSearchContentMode] -> ShowS)
-> Show FTSearchContentMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSearchContentMode -> ShowS
showsPrec :: Int -> FTSearchContentMode -> ShowS
$cshow :: FTSearchContentMode -> String
show :: FTSearchContentMode -> String
$cshowList :: [FTSearchContentMode] -> ShowS
showList :: [FTSearchContentMode] -> ShowS
Show, FTSearchContentMode -> FTSearchContentMode -> Bool
(FTSearchContentMode -> FTSearchContentMode -> Bool)
-> (FTSearchContentMode -> FTSearchContentMode -> Bool)
-> Eq FTSearchContentMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSearchContentMode -> FTSearchContentMode -> Bool
== :: FTSearchContentMode -> FTSearchContentMode -> Bool
$c/= :: FTSearchContentMode -> FTSearchContentMode -> Bool
/= :: FTSearchContentMode -> FTSearchContentMode -> Bool
Eq)

data FTSearchScoreMode
    = FTSearchNoScores
    | FTSearchWithScores
    | FTSearchWithExplainScore
    deriving (Int -> FTSearchScoreMode -> ShowS
[FTSearchScoreMode] -> ShowS
FTSearchScoreMode -> String
(Int -> FTSearchScoreMode -> ShowS)
-> (FTSearchScoreMode -> String)
-> ([FTSearchScoreMode] -> ShowS)
-> Show FTSearchScoreMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSearchScoreMode -> ShowS
showsPrec :: Int -> FTSearchScoreMode -> ShowS
$cshow :: FTSearchScoreMode -> String
show :: FTSearchScoreMode -> String
$cshowList :: [FTSearchScoreMode] -> ShowS
showList :: [FTSearchScoreMode] -> ShowS
Show, FTSearchScoreMode -> FTSearchScoreMode -> Bool
(FTSearchScoreMode -> FTSearchScoreMode -> Bool)
-> (FTSearchScoreMode -> FTSearchScoreMode -> Bool)
-> Eq FTSearchScoreMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSearchScoreMode -> FTSearchScoreMode -> Bool
== :: FTSearchScoreMode -> FTSearchScoreMode -> Bool
$c/= :: FTSearchScoreMode -> FTSearchScoreMode -> Bool
/= :: FTSearchScoreMode -> FTSearchScoreMode -> Bool
Eq)

data FTSearchPayloadMode
    = FTSearchNoPayloads
    | FTSearchWithPayloads
    deriving (Int -> FTSearchPayloadMode -> ShowS
[FTSearchPayloadMode] -> ShowS
FTSearchPayloadMode -> String
(Int -> FTSearchPayloadMode -> ShowS)
-> (FTSearchPayloadMode -> String)
-> ([FTSearchPayloadMode] -> ShowS)
-> Show FTSearchPayloadMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSearchPayloadMode -> ShowS
showsPrec :: Int -> FTSearchPayloadMode -> ShowS
$cshow :: FTSearchPayloadMode -> String
show :: FTSearchPayloadMode -> String
$cshowList :: [FTSearchPayloadMode] -> ShowS
showList :: [FTSearchPayloadMode] -> ShowS
Show, FTSearchPayloadMode -> FTSearchPayloadMode -> Bool
(FTSearchPayloadMode -> FTSearchPayloadMode -> Bool)
-> (FTSearchPayloadMode -> FTSearchPayloadMode -> Bool)
-> Eq FTSearchPayloadMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSearchPayloadMode -> FTSearchPayloadMode -> Bool
== :: FTSearchPayloadMode -> FTSearchPayloadMode -> Bool
$c/= :: FTSearchPayloadMode -> FTSearchPayloadMode -> Bool
/= :: FTSearchPayloadMode -> FTSearchPayloadMode -> Bool
Eq)

data FTSearchSortKeysMode
    = FTSearchNoSortKeys
    | FTSearchWithSortKeys
    deriving (Int -> FTSearchSortKeysMode -> ShowS
[FTSearchSortKeysMode] -> ShowS
FTSearchSortKeysMode -> String
(Int -> FTSearchSortKeysMode -> ShowS)
-> (FTSearchSortKeysMode -> String)
-> ([FTSearchSortKeysMode] -> ShowS)
-> Show FTSearchSortKeysMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSearchSortKeysMode -> ShowS
showsPrec :: Int -> FTSearchSortKeysMode -> ShowS
$cshow :: FTSearchSortKeysMode -> String
show :: FTSearchSortKeysMode -> String
$cshowList :: [FTSearchSortKeysMode] -> ShowS
showList :: [FTSearchSortKeysMode] -> ShowS
Show, FTSearchSortKeysMode -> FTSearchSortKeysMode -> Bool
(FTSearchSortKeysMode -> FTSearchSortKeysMode -> Bool)
-> (FTSearchSortKeysMode -> FTSearchSortKeysMode -> Bool)
-> Eq FTSearchSortKeysMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSearchSortKeysMode -> FTSearchSortKeysMode -> Bool
== :: FTSearchSortKeysMode -> FTSearchSortKeysMode -> Bool
$c/= :: FTSearchSortKeysMode -> FTSearchSortKeysMode -> Bool
/= :: FTSearchSortKeysMode -> FTSearchSortKeysMode -> Bool
Eq)

data FTReturnField
    = FTReturnField ByteString
    | FTReturnFieldAs ByteString ByteString
    deriving (Int -> FTReturnField -> ShowS
[FTReturnField] -> ShowS
FTReturnField -> String
(Int -> FTReturnField -> ShowS)
-> (FTReturnField -> String)
-> ([FTReturnField] -> ShowS)
-> Show FTReturnField
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTReturnField -> ShowS
showsPrec :: Int -> FTReturnField -> ShowS
$cshow :: FTReturnField -> String
show :: FTReturnField -> String
$cshowList :: [FTReturnField] -> ShowS
showList :: [FTReturnField] -> ShowS
Show, FTReturnField -> FTReturnField -> Bool
(FTReturnField -> FTReturnField -> Bool)
-> (FTReturnField -> FTReturnField -> Bool) -> Eq FTReturnField
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTReturnField -> FTReturnField -> Bool
== :: FTReturnField -> FTReturnField -> Bool
$c/= :: FTReturnField -> FTReturnField -> Bool
/= :: FTReturnField -> FTReturnField -> Bool
Eq)

data FTSummarizeOpts = FTSummarizeOpts
    { FTSummarizeOpts -> [ByteString]
ftSummarizeFields :: [ByteString]
    , FTSummarizeOpts -> Maybe Integer
ftSummarizeFrags :: Maybe Integer
    , FTSummarizeOpts -> Maybe Integer
ftSummarizeLen :: Maybe Integer
    , FTSummarizeOpts -> Maybe ByteString
ftSummarizeSeparator :: Maybe ByteString
    } deriving (Int -> FTSummarizeOpts -> ShowS
[FTSummarizeOpts] -> ShowS
FTSummarizeOpts -> String
(Int -> FTSummarizeOpts -> ShowS)
-> (FTSummarizeOpts -> String)
-> ([FTSummarizeOpts] -> ShowS)
-> Show FTSummarizeOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSummarizeOpts -> ShowS
showsPrec :: Int -> FTSummarizeOpts -> ShowS
$cshow :: FTSummarizeOpts -> String
show :: FTSummarizeOpts -> String
$cshowList :: [FTSummarizeOpts] -> ShowS
showList :: [FTSummarizeOpts] -> ShowS
Show, FTSummarizeOpts -> FTSummarizeOpts -> Bool
(FTSummarizeOpts -> FTSummarizeOpts -> Bool)
-> (FTSummarizeOpts -> FTSummarizeOpts -> Bool)
-> Eq FTSummarizeOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSummarizeOpts -> FTSummarizeOpts -> Bool
== :: FTSummarizeOpts -> FTSummarizeOpts -> Bool
$c/= :: FTSummarizeOpts -> FTSummarizeOpts -> Bool
/= :: FTSummarizeOpts -> FTSummarizeOpts -> Bool
Eq)

defaultFTSummarizeOpts :: FTSummarizeOpts
defaultFTSummarizeOpts :: FTSummarizeOpts
defaultFTSummarizeOpts = FTSummarizeOpts
    { ftSummarizeFields :: [ByteString]
ftSummarizeFields = []
    , ftSummarizeFrags :: Maybe Integer
ftSummarizeFrags = Maybe Integer
forall a. Maybe a
Nothing
    , ftSummarizeLen :: Maybe Integer
ftSummarizeLen = Maybe Integer
forall a. Maybe a
Nothing
    , ftSummarizeSeparator :: Maybe ByteString
ftSummarizeSeparator = Maybe ByteString
forall a. Maybe a
Nothing
    }

data FTHighlightOpts = FTHighlightOpts
    { FTHighlightOpts -> [ByteString]
ftHighlightFields :: [ByteString]
    , FTHighlightOpts -> Maybe (ByteString, ByteString)
ftHighlightTags :: Maybe (ByteString, ByteString)
    } deriving (Int -> FTHighlightOpts -> ShowS
[FTHighlightOpts] -> ShowS
FTHighlightOpts -> String
(Int -> FTHighlightOpts -> ShowS)
-> (FTHighlightOpts -> String)
-> ([FTHighlightOpts] -> ShowS)
-> Show FTHighlightOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTHighlightOpts -> ShowS
showsPrec :: Int -> FTHighlightOpts -> ShowS
$cshow :: FTHighlightOpts -> String
show :: FTHighlightOpts -> String
$cshowList :: [FTHighlightOpts] -> ShowS
showList :: [FTHighlightOpts] -> ShowS
Show, FTHighlightOpts -> FTHighlightOpts -> Bool
(FTHighlightOpts -> FTHighlightOpts -> Bool)
-> (FTHighlightOpts -> FTHighlightOpts -> Bool)
-> Eq FTHighlightOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTHighlightOpts -> FTHighlightOpts -> Bool
== :: FTHighlightOpts -> FTHighlightOpts -> Bool
$c/= :: FTHighlightOpts -> FTHighlightOpts -> Bool
/= :: FTHighlightOpts -> FTHighlightOpts -> Bool
Eq)

defaultFTHighlightOpts :: FTHighlightOpts
defaultFTHighlightOpts :: FTHighlightOpts
defaultFTHighlightOpts = FTHighlightOpts
    { ftHighlightFields :: [ByteString]
ftHighlightFields = []
    , ftHighlightTags :: Maybe (ByteString, ByteString)
ftHighlightTags = Maybe (ByteString, ByteString)
forall a. Maybe a
Nothing
    }

data FTNumericFilter = FTNumericFilter
    { FTNumericFilter -> ByteString
ftNumericFilterField :: ByteString
    , FTNumericFilter -> Double
ftNumericFilterMin :: Double
    , FTNumericFilter -> Double
ftNumericFilterMax :: Double
    } deriving (Int -> FTNumericFilter -> ShowS
[FTNumericFilter] -> ShowS
FTNumericFilter -> String
(Int -> FTNumericFilter -> ShowS)
-> (FTNumericFilter -> String)
-> ([FTNumericFilter] -> ShowS)
-> Show FTNumericFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTNumericFilter -> ShowS
showsPrec :: Int -> FTNumericFilter -> ShowS
$cshow :: FTNumericFilter -> String
show :: FTNumericFilter -> String
$cshowList :: [FTNumericFilter] -> ShowS
showList :: [FTNumericFilter] -> ShowS
Show, FTNumericFilter -> FTNumericFilter -> Bool
(FTNumericFilter -> FTNumericFilter -> Bool)
-> (FTNumericFilter -> FTNumericFilter -> Bool)
-> Eq FTNumericFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTNumericFilter -> FTNumericFilter -> Bool
== :: FTNumericFilter -> FTNumericFilter -> Bool
$c/= :: FTNumericFilter -> FTNumericFilter -> Bool
/= :: FTNumericFilter -> FTNumericFilter -> Bool
Eq)

data FTGeoFilter = FTGeoFilter
    { FTGeoFilter -> ByteString
ftGeoFilterField :: ByteString
    , FTGeoFilter -> Double
ftGeoFilterLongitude :: Double
    , FTGeoFilter -> Double
ftGeoFilterLatitude :: Double
    , FTGeoFilter -> Double
ftGeoFilterRadius :: Double
    , FTGeoFilter -> GeoUnit
ftGeoFilterUnit :: GeoUnit
    } deriving (Int -> FTGeoFilter -> ShowS
[FTGeoFilter] -> ShowS
FTGeoFilter -> String
(Int -> FTGeoFilter -> ShowS)
-> (FTGeoFilter -> String)
-> ([FTGeoFilter] -> ShowS)
-> Show FTGeoFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTGeoFilter -> ShowS
showsPrec :: Int -> FTGeoFilter -> ShowS
$cshow :: FTGeoFilter -> String
show :: FTGeoFilter -> String
$cshowList :: [FTGeoFilter] -> ShowS
showList :: [FTGeoFilter] -> ShowS
Show, FTGeoFilter -> FTGeoFilter -> Bool
(FTGeoFilter -> FTGeoFilter -> Bool)
-> (FTGeoFilter -> FTGeoFilter -> Bool) -> Eq FTGeoFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTGeoFilter -> FTGeoFilter -> Bool
== :: FTGeoFilter -> FTGeoFilter -> Bool
$c/= :: FTGeoFilter -> FTGeoFilter -> Bool
/= :: FTGeoFilter -> FTGeoFilter -> Bool
Eq)

data FTSortBy = FTSortBy
    { FTSortBy -> ByteString
ftSortByField :: ByteString
    , FTSortBy -> Maybe SortOrder
ftSortByOrder :: Maybe SortOrder
    } deriving (Int -> FTSortBy -> ShowS
[FTSortBy] -> ShowS
FTSortBy -> String
(Int -> FTSortBy -> ShowS)
-> (FTSortBy -> String) -> ([FTSortBy] -> ShowS) -> Show FTSortBy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSortBy -> ShowS
showsPrec :: Int -> FTSortBy -> ShowS
$cshow :: FTSortBy -> String
show :: FTSortBy -> String
$cshowList :: [FTSortBy] -> ShowS
showList :: [FTSortBy] -> ShowS
Show, FTSortBy -> FTSortBy -> Bool
(FTSortBy -> FTSortBy -> Bool)
-> (FTSortBy -> FTSortBy -> Bool) -> Eq FTSortBy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSortBy -> FTSortBy -> Bool
== :: FTSortBy -> FTSortBy -> Bool
$c/= :: FTSortBy -> FTSortBy -> Bool
/= :: FTSortBy -> FTSortBy -> Bool
Eq)

data FTSearchOpts = FTSearchOpts
    { FTSearchOpts -> FTSearchContentMode
ftSearchContentMode :: FTSearchContentMode
    , FTSearchOpts -> Bool
ftSearchVerbatim :: Bool
    , FTSearchOpts -> Bool
ftSearchNoStopWords :: Bool
    , FTSearchOpts -> FTSearchScoreMode
ftSearchScoreMode :: FTSearchScoreMode
    , FTSearchOpts -> FTSearchPayloadMode
ftSearchPayloadMode :: FTSearchPayloadMode
    , FTSearchOpts -> FTSearchSortKeysMode
ftSearchSortKeysMode :: FTSearchSortKeysMode
    , FTSearchOpts -> [FTNumericFilter]
ftSearchNumericFilters :: [FTNumericFilter]
    , FTSearchOpts -> [FTGeoFilter]
ftSearchGeoFilters :: [FTGeoFilter]
    , FTSearchOpts -> [ByteString]
ftSearchInKeys :: [ByteString]
    , FTSearchOpts -> [ByteString]
ftSearchInFields :: [ByteString]
    , FTSearchOpts -> [FTReturnField]
ftSearchReturnFields :: [FTReturnField]
    , FTSearchOpts -> Maybe FTSummarizeOpts
ftSearchSummarize :: Maybe FTSummarizeOpts
    , FTSearchOpts -> Maybe FTHighlightOpts
ftSearchHighlight :: Maybe FTHighlightOpts
    , FTSearchOpts -> Maybe Integer
ftSearchSlop :: Maybe Integer
    , FTSearchOpts -> Maybe Integer
ftSearchTimeout :: Maybe Integer
    , FTSearchOpts -> Bool
ftSearchInOrder :: Bool
    , FTSearchOpts -> Maybe ByteString
ftSearchLanguage :: Maybe ByteString
    , FTSearchOpts -> Maybe ByteString
ftSearchExpander :: Maybe ByteString
    , FTSearchOpts -> Maybe ByteString
ftSearchScorer :: Maybe ByteString
    , FTSearchOpts -> Maybe ByteString
ftSearchPayload :: Maybe ByteString
    , FTSearchOpts -> Maybe FTSortBy
ftSearchSortBy :: Maybe FTSortBy
    , FTSearchOpts -> Maybe (Integer, Integer)
ftSearchLimit :: Maybe (Integer, Integer)
    , FTSearchOpts -> [(ByteString, ByteString)]
ftSearchParams :: [(ByteString, ByteString)]
    , FTSearchOpts -> Maybe Integer
ftSearchDialect :: Maybe Integer
    } deriving (Int -> FTSearchOpts -> ShowS
[FTSearchOpts] -> ShowS
FTSearchOpts -> String
(Int -> FTSearchOpts -> ShowS)
-> (FTSearchOpts -> String)
-> ([FTSearchOpts] -> ShowS)
-> Show FTSearchOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSearchOpts -> ShowS
showsPrec :: Int -> FTSearchOpts -> ShowS
$cshow :: FTSearchOpts -> String
show :: FTSearchOpts -> String
$cshowList :: [FTSearchOpts] -> ShowS
showList :: [FTSearchOpts] -> ShowS
Show, FTSearchOpts -> FTSearchOpts -> Bool
(FTSearchOpts -> FTSearchOpts -> Bool)
-> (FTSearchOpts -> FTSearchOpts -> Bool) -> Eq FTSearchOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSearchOpts -> FTSearchOpts -> Bool
== :: FTSearchOpts -> FTSearchOpts -> Bool
$c/= :: FTSearchOpts -> FTSearchOpts -> Bool
/= :: FTSearchOpts -> FTSearchOpts -> Bool
Eq)

defaultFTSearchOpts :: FTSearchOpts
defaultFTSearchOpts :: FTSearchOpts
defaultFTSearchOpts = FTSearchOpts
    { ftSearchContentMode :: FTSearchContentMode
ftSearchContentMode = FTSearchContentMode
FTSearchReturnDocuments
    , ftSearchVerbatim :: Bool
ftSearchVerbatim = Bool
False
    , ftSearchNoStopWords :: Bool
ftSearchNoStopWords = Bool
False
    , ftSearchScoreMode :: FTSearchScoreMode
ftSearchScoreMode = FTSearchScoreMode
FTSearchNoScores
    , ftSearchPayloadMode :: FTSearchPayloadMode
ftSearchPayloadMode = FTSearchPayloadMode
FTSearchNoPayloads
    , ftSearchSortKeysMode :: FTSearchSortKeysMode
ftSearchSortKeysMode = FTSearchSortKeysMode
FTSearchNoSortKeys
    , ftSearchNumericFilters :: [FTNumericFilter]
ftSearchNumericFilters = []
    , ftSearchGeoFilters :: [FTGeoFilter]
ftSearchGeoFilters = []
    , ftSearchInKeys :: [ByteString]
ftSearchInKeys = []
    , ftSearchInFields :: [ByteString]
ftSearchInFields = []
    , ftSearchReturnFields :: [FTReturnField]
ftSearchReturnFields = []
    , ftSearchSummarize :: Maybe FTSummarizeOpts
ftSearchSummarize = Maybe FTSummarizeOpts
forall a. Maybe a
Nothing
    , ftSearchHighlight :: Maybe FTHighlightOpts
ftSearchHighlight = Maybe FTHighlightOpts
forall a. Maybe a
Nothing
    , ftSearchSlop :: Maybe Integer
ftSearchSlop = Maybe Integer
forall a. Maybe a
Nothing
    , ftSearchTimeout :: Maybe Integer
ftSearchTimeout = Maybe Integer
forall a. Maybe a
Nothing
    , ftSearchInOrder :: Bool
ftSearchInOrder = Bool
False
    , ftSearchLanguage :: Maybe ByteString
ftSearchLanguage = Maybe ByteString
forall a. Maybe a
Nothing
    , ftSearchExpander :: Maybe ByteString
ftSearchExpander = Maybe ByteString
forall a. Maybe a
Nothing
    , ftSearchScorer :: Maybe ByteString
ftSearchScorer = Maybe ByteString
forall a. Maybe a
Nothing
    , ftSearchPayload :: Maybe ByteString
ftSearchPayload = Maybe ByteString
forall a. Maybe a
Nothing
    , ftSearchSortBy :: Maybe FTSortBy
ftSearchSortBy = Maybe FTSortBy
forall a. Maybe a
Nothing
    , ftSearchLimit :: Maybe (Integer, Integer)
ftSearchLimit = Maybe (Integer, Integer)
forall a. Maybe a
Nothing
    , ftSearchParams :: [(ByteString, ByteString)]
ftSearchParams = []
    , ftSearchDialect :: Maybe Integer
ftSearchDialect = Maybe Integer
forall a. Maybe a
Nothing
    }

data FTAggregateLoad
    = FTAggregateLoadAll
    | FTAggregateLoadFields (NonEmpty ByteString)
    deriving (Int -> FTAggregateLoad -> ShowS
[FTAggregateLoad] -> ShowS
FTAggregateLoad -> String
(Int -> FTAggregateLoad -> ShowS)
-> (FTAggregateLoad -> String)
-> ([FTAggregateLoad] -> ShowS)
-> Show FTAggregateLoad
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTAggregateLoad -> ShowS
showsPrec :: Int -> FTAggregateLoad -> ShowS
$cshow :: FTAggregateLoad -> String
show :: FTAggregateLoad -> String
$cshowList :: [FTAggregateLoad] -> ShowS
showList :: [FTAggregateLoad] -> ShowS
Show, FTAggregateLoad -> FTAggregateLoad -> Bool
(FTAggregateLoad -> FTAggregateLoad -> Bool)
-> (FTAggregateLoad -> FTAggregateLoad -> Bool)
-> Eq FTAggregateLoad
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTAggregateLoad -> FTAggregateLoad -> Bool
== :: FTAggregateLoad -> FTAggregateLoad -> Bool
$c/= :: FTAggregateLoad -> FTAggregateLoad -> Bool
/= :: FTAggregateLoad -> FTAggregateLoad -> Bool
Eq)

data FTSortProperty = FTSortProperty
    { FTSortProperty -> ByteString
ftSortPropertyName :: ByteString
    , FTSortProperty -> Maybe SortOrder
ftSortPropertyOrder :: Maybe SortOrder
    } deriving (Int -> FTSortProperty -> ShowS
[FTSortProperty] -> ShowS
FTSortProperty -> String
(Int -> FTSortProperty -> ShowS)
-> (FTSortProperty -> String)
-> ([FTSortProperty] -> ShowS)
-> Show FTSortProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSortProperty -> ShowS
showsPrec :: Int -> FTSortProperty -> ShowS
$cshow :: FTSortProperty -> String
show :: FTSortProperty -> String
$cshowList :: [FTSortProperty] -> ShowS
showList :: [FTSortProperty] -> ShowS
Show, FTSortProperty -> FTSortProperty -> Bool
(FTSortProperty -> FTSortProperty -> Bool)
-> (FTSortProperty -> FTSortProperty -> Bool) -> Eq FTSortProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSortProperty -> FTSortProperty -> Bool
== :: FTSortProperty -> FTSortProperty -> Bool
$c/= :: FTSortProperty -> FTSortProperty -> Bool
/= :: FTSortProperty -> FTSortProperty -> Bool
Eq)

data FTReduce = FTReduce
    { FTReduce -> ByteString
ftReduceFunction :: ByteString
    , FTReduce -> [ByteString]
ftReduceArgs :: [ByteString]
    , FTReduce -> Maybe ByteString
ftReduceAlias :: Maybe ByteString
    } deriving (Int -> FTReduce -> ShowS
[FTReduce] -> ShowS
FTReduce -> String
(Int -> FTReduce -> ShowS)
-> (FTReduce -> String) -> ([FTReduce] -> ShowS) -> Show FTReduce
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTReduce -> ShowS
showsPrec :: Int -> FTReduce -> ShowS
$cshow :: FTReduce -> String
show :: FTReduce -> String
$cshowList :: [FTReduce] -> ShowS
showList :: [FTReduce] -> ShowS
Show, FTReduce -> FTReduce -> Bool
(FTReduce -> FTReduce -> Bool)
-> (FTReduce -> FTReduce -> Bool) -> Eq FTReduce
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTReduce -> FTReduce -> Bool
== :: FTReduce -> FTReduce -> Bool
$c/= :: FTReduce -> FTReduce -> Bool
/= :: FTReduce -> FTReduce -> Bool
Eq)

data FTGroupBy = FTGroupBy
    { FTGroupBy -> NonEmpty ByteString
ftGroupByProperties :: NonEmpty ByteString
    , FTGroupBy -> [FTReduce]
ftGroupByReducers :: [FTReduce]
    } deriving (Int -> FTGroupBy -> ShowS
[FTGroupBy] -> ShowS
FTGroupBy -> String
(Int -> FTGroupBy -> ShowS)
-> (FTGroupBy -> String)
-> ([FTGroupBy] -> ShowS)
-> Show FTGroupBy
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTGroupBy -> ShowS
showsPrec :: Int -> FTGroupBy -> ShowS
$cshow :: FTGroupBy -> String
show :: FTGroupBy -> String
$cshowList :: [FTGroupBy] -> ShowS
showList :: [FTGroupBy] -> ShowS
Show, FTGroupBy -> FTGroupBy -> Bool
(FTGroupBy -> FTGroupBy -> Bool)
-> (FTGroupBy -> FTGroupBy -> Bool) -> Eq FTGroupBy
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTGroupBy -> FTGroupBy -> Bool
== :: FTGroupBy -> FTGroupBy -> Bool
$c/= :: FTGroupBy -> FTGroupBy -> Bool
/= :: FTGroupBy -> FTGroupBy -> Bool
Eq)

data FTApply = FTApply
    { FTApply -> ByteString
ftApplyExpression :: ByteString
    , FTApply -> Maybe ByteString
ftApplyAlias :: Maybe ByteString
    } deriving (Int -> FTApply -> ShowS
[FTApply] -> ShowS
FTApply -> String
(Int -> FTApply -> ShowS)
-> (FTApply -> String) -> ([FTApply] -> ShowS) -> Show FTApply
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTApply -> ShowS
showsPrec :: Int -> FTApply -> ShowS
$cshow :: FTApply -> String
show :: FTApply -> String
$cshowList :: [FTApply] -> ShowS
showList :: [FTApply] -> ShowS
Show, FTApply -> FTApply -> Bool
(FTApply -> FTApply -> Bool)
-> (FTApply -> FTApply -> Bool) -> Eq FTApply
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTApply -> FTApply -> Bool
== :: FTApply -> FTApply -> Bool
$c/= :: FTApply -> FTApply -> Bool
/= :: FTApply -> FTApply -> Bool
Eq)

data FTCursorOpts = FTCursorOpts
    { FTCursorOpts -> Maybe Integer
ftCursorCount :: Maybe Integer
    , FTCursorOpts -> Maybe Integer
ftCursorMaxIdle :: Maybe Integer
    } deriving (Int -> FTCursorOpts -> ShowS
[FTCursorOpts] -> ShowS
FTCursorOpts -> String
(Int -> FTCursorOpts -> ShowS)
-> (FTCursorOpts -> String)
-> ([FTCursorOpts] -> ShowS)
-> Show FTCursorOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTCursorOpts -> ShowS
showsPrec :: Int -> FTCursorOpts -> ShowS
$cshow :: FTCursorOpts -> String
show :: FTCursorOpts -> String
$cshowList :: [FTCursorOpts] -> ShowS
showList :: [FTCursorOpts] -> ShowS
Show, FTCursorOpts -> FTCursorOpts -> Bool
(FTCursorOpts -> FTCursorOpts -> Bool)
-> (FTCursorOpts -> FTCursorOpts -> Bool) -> Eq FTCursorOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTCursorOpts -> FTCursorOpts -> Bool
== :: FTCursorOpts -> FTCursorOpts -> Bool
$c/= :: FTCursorOpts -> FTCursorOpts -> Bool
/= :: FTCursorOpts -> FTCursorOpts -> Bool
Eq)

defaultFTCursorOpts :: FTCursorOpts
defaultFTCursorOpts :: FTCursorOpts
defaultFTCursorOpts = FTCursorOpts
    { ftCursorCount :: Maybe Integer
ftCursorCount = Maybe Integer
forall a. Maybe a
Nothing
    , ftCursorMaxIdle :: Maybe Integer
ftCursorMaxIdle = Maybe Integer
forall a. Maybe a
Nothing
    }

data FTAggregateOpts = FTAggregateOpts
    { FTAggregateOpts -> Bool
ftAggregateVerbatim :: Bool
    , FTAggregateOpts -> Maybe FTAggregateLoad
ftAggregateLoad :: Maybe FTAggregateLoad
    , FTAggregateOpts -> Maybe Integer
ftAggregateTimeout :: Maybe Integer
    , FTAggregateOpts -> [FTGroupBy]
ftAggregateGroupBy :: [FTGroupBy]
    , FTAggregateOpts -> Maybe (NonEmpty FTSortProperty, Maybe Integer)
ftAggregateSortBy :: Maybe (NonEmpty FTSortProperty, Maybe Integer)
    , FTAggregateOpts -> [FTApply]
ftAggregateApply :: [FTApply]
    , FTAggregateOpts -> Maybe (Integer, Integer)
ftAggregateLimit :: Maybe (Integer, Integer)
    , FTAggregateOpts -> Maybe ByteString
ftAggregateFilter :: Maybe ByteString
    , FTAggregateOpts -> Maybe FTCursorOpts
ftAggregateCursor :: Maybe FTCursorOpts
    , FTAggregateOpts -> [(ByteString, ByteString)]
ftAggregateParams :: [(ByteString, ByteString)]
    , FTAggregateOpts -> Maybe Integer
ftAggregateDialect :: Maybe Integer
    } deriving (Int -> FTAggregateOpts -> ShowS
[FTAggregateOpts] -> ShowS
FTAggregateOpts -> String
(Int -> FTAggregateOpts -> ShowS)
-> (FTAggregateOpts -> String)
-> ([FTAggregateOpts] -> ShowS)
-> Show FTAggregateOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTAggregateOpts -> ShowS
showsPrec :: Int -> FTAggregateOpts -> ShowS
$cshow :: FTAggregateOpts -> String
show :: FTAggregateOpts -> String
$cshowList :: [FTAggregateOpts] -> ShowS
showList :: [FTAggregateOpts] -> ShowS
Show, FTAggregateOpts -> FTAggregateOpts -> Bool
(FTAggregateOpts -> FTAggregateOpts -> Bool)
-> (FTAggregateOpts -> FTAggregateOpts -> Bool)
-> Eq FTAggregateOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTAggregateOpts -> FTAggregateOpts -> Bool
== :: FTAggregateOpts -> FTAggregateOpts -> Bool
$c/= :: FTAggregateOpts -> FTAggregateOpts -> Bool
/= :: FTAggregateOpts -> FTAggregateOpts -> Bool
Eq)

defaultFTAggregateOpts :: FTAggregateOpts
defaultFTAggregateOpts :: FTAggregateOpts
defaultFTAggregateOpts = FTAggregateOpts
    { ftAggregateVerbatim :: Bool
ftAggregateVerbatim = Bool
False
    , ftAggregateLoad :: Maybe FTAggregateLoad
ftAggregateLoad = Maybe FTAggregateLoad
forall a. Maybe a
Nothing
    , ftAggregateTimeout :: Maybe Integer
ftAggregateTimeout = Maybe Integer
forall a. Maybe a
Nothing
    , ftAggregateGroupBy :: [FTGroupBy]
ftAggregateGroupBy = []
    , ftAggregateSortBy :: Maybe (NonEmpty FTSortProperty, Maybe Integer)
ftAggregateSortBy = Maybe (NonEmpty FTSortProperty, Maybe Integer)
forall a. Maybe a
Nothing
    , ftAggregateApply :: [FTApply]
ftAggregateApply = []
    , ftAggregateLimit :: Maybe (Integer, Integer)
ftAggregateLimit = Maybe (Integer, Integer)
forall a. Maybe a
Nothing
    , ftAggregateFilter :: Maybe ByteString
ftAggregateFilter = Maybe ByteString
forall a. Maybe a
Nothing
    , ftAggregateCursor :: Maybe FTCursorOpts
ftAggregateCursor = Maybe FTCursorOpts
forall a. Maybe a
Nothing
    , ftAggregateParams :: [(ByteString, ByteString)]
ftAggregateParams = []
    , ftAggregateDialect :: Maybe Integer
ftAggregateDialect = Maybe Integer
forall a. Maybe a
Nothing
    }

data FTHybridSearchClause = FTHybridSearchClause
    { FTHybridSearchClause -> ByteString
ftHybridSearchQuery :: ByteString
    , FTHybridSearchClause -> Maybe ByteString
ftHybridSearchScorer :: Maybe ByteString
    , FTHybridSearchClause -> Maybe ByteString
ftHybridSearchYieldScoreAs :: Maybe ByteString
    } deriving (Int -> FTHybridSearchClause -> ShowS
[FTHybridSearchClause] -> ShowS
FTHybridSearchClause -> String
(Int -> FTHybridSearchClause -> ShowS)
-> (FTHybridSearchClause -> String)
-> ([FTHybridSearchClause] -> ShowS)
-> Show FTHybridSearchClause
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTHybridSearchClause -> ShowS
showsPrec :: Int -> FTHybridSearchClause -> ShowS
$cshow :: FTHybridSearchClause -> String
show :: FTHybridSearchClause -> String
$cshowList :: [FTHybridSearchClause] -> ShowS
showList :: [FTHybridSearchClause] -> ShowS
Show, FTHybridSearchClause -> FTHybridSearchClause -> Bool
(FTHybridSearchClause -> FTHybridSearchClause -> Bool)
-> (FTHybridSearchClause -> FTHybridSearchClause -> Bool)
-> Eq FTHybridSearchClause
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTHybridSearchClause -> FTHybridSearchClause -> Bool
== :: FTHybridSearchClause -> FTHybridSearchClause -> Bool
$c/= :: FTHybridSearchClause -> FTHybridSearchClause -> Bool
/= :: FTHybridSearchClause -> FTHybridSearchClause -> Bool
Eq)

data FTHybridVectorQuery
    = FTHybridKnn
        { FTHybridVectorQuery -> Integer
ftHybridKnnCount :: Integer
        , FTHybridVectorQuery -> Integer
ftHybridKnnK :: Integer
        , FTHybridVectorQuery -> Maybe Integer
ftHybridKnnEfRuntime :: Maybe Integer
        , FTHybridVectorQuery -> Maybe ByteString
ftHybridKnnYieldScoreAs :: Maybe ByteString
        }
    | FTHybridRange
        { FTHybridVectorQuery -> Integer
ftHybridRangeCount :: Integer
        , FTHybridVectorQuery -> Double
ftHybridRangeRadius :: Double
        , FTHybridVectorQuery -> Maybe Double
ftHybridRangeEpsilon :: Maybe Double
        , FTHybridVectorQuery -> Maybe ByteString
ftHybridRangeYieldScoreAs :: Maybe ByteString
        }
    deriving (Int -> FTHybridVectorQuery -> ShowS
[FTHybridVectorQuery] -> ShowS
FTHybridVectorQuery -> String
(Int -> FTHybridVectorQuery -> ShowS)
-> (FTHybridVectorQuery -> String)
-> ([FTHybridVectorQuery] -> ShowS)
-> Show FTHybridVectorQuery
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTHybridVectorQuery -> ShowS
showsPrec :: Int -> FTHybridVectorQuery -> ShowS
$cshow :: FTHybridVectorQuery -> String
show :: FTHybridVectorQuery -> String
$cshowList :: [FTHybridVectorQuery] -> ShowS
showList :: [FTHybridVectorQuery] -> ShowS
Show, FTHybridVectorQuery -> FTHybridVectorQuery -> Bool
(FTHybridVectorQuery -> FTHybridVectorQuery -> Bool)
-> (FTHybridVectorQuery -> FTHybridVectorQuery -> Bool)
-> Eq FTHybridVectorQuery
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTHybridVectorQuery -> FTHybridVectorQuery -> Bool
== :: FTHybridVectorQuery -> FTHybridVectorQuery -> Bool
$c/= :: FTHybridVectorQuery -> FTHybridVectorQuery -> Bool
/= :: FTHybridVectorQuery -> FTHybridVectorQuery -> Bool
Eq)

data FTHybridVSimClause = FTHybridVSimClause
    { FTHybridVSimClause -> ByteString
ftHybridVSimField :: ByteString
    , FTHybridVSimClause -> ByteString
ftHybridVSimVector :: ByteString
    , FTHybridVSimClause -> Maybe FTHybridVectorQuery
ftHybridVSimQuery :: Maybe FTHybridVectorQuery
    , FTHybridVSimClause -> Maybe ByteString
ftHybridVSimFilter :: Maybe ByteString
    } deriving (Int -> FTHybridVSimClause -> ShowS
[FTHybridVSimClause] -> ShowS
FTHybridVSimClause -> String
(Int -> FTHybridVSimClause -> ShowS)
-> (FTHybridVSimClause -> String)
-> ([FTHybridVSimClause] -> ShowS)
-> Show FTHybridVSimClause
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTHybridVSimClause -> ShowS
showsPrec :: Int -> FTHybridVSimClause -> ShowS
$cshow :: FTHybridVSimClause -> String
show :: FTHybridVSimClause -> String
$cshowList :: [FTHybridVSimClause] -> ShowS
showList :: [FTHybridVSimClause] -> ShowS
Show, FTHybridVSimClause -> FTHybridVSimClause -> Bool
(FTHybridVSimClause -> FTHybridVSimClause -> Bool)
-> (FTHybridVSimClause -> FTHybridVSimClause -> Bool)
-> Eq FTHybridVSimClause
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTHybridVSimClause -> FTHybridVSimClause -> Bool
== :: FTHybridVSimClause -> FTHybridVSimClause -> Bool
$c/= :: FTHybridVSimClause -> FTHybridVSimClause -> Bool
/= :: FTHybridVSimClause -> FTHybridVSimClause -> Bool
Eq)

data FTHybridCombine
    = FTHybridCombineRRF
        { FTHybridCombine -> Integer
ftHybridRrfCount :: Integer
        , FTHybridCombine -> Maybe Double
ftHybridRrfConstant :: Maybe Double
        , FTHybridCombine -> Maybe Integer
ftHybridRrfWindow :: Maybe Integer
        , FTHybridCombine -> Maybe ByteString
ftHybridRrfYieldScoreAs :: Maybe ByteString
        }
    | FTHybridCombineLinear
        { FTHybridCombine -> Integer
ftHybridLinearCount :: Integer
        , FTHybridCombine -> Maybe (Double, Double)
ftHybridLinearAlphaBeta :: Maybe (Double, Double)
        , FTHybridCombine -> Maybe Integer
ftHybridLinearWindow :: Maybe Integer
        , FTHybridCombine -> Maybe ByteString
ftHybridLinearYieldScoreAs :: Maybe ByteString
        }
    deriving (Int -> FTHybridCombine -> ShowS
[FTHybridCombine] -> ShowS
FTHybridCombine -> String
(Int -> FTHybridCombine -> ShowS)
-> (FTHybridCombine -> String)
-> ([FTHybridCombine] -> ShowS)
-> Show FTHybridCombine
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTHybridCombine -> ShowS
showsPrec :: Int -> FTHybridCombine -> ShowS
$cshow :: FTHybridCombine -> String
show :: FTHybridCombine -> String
$cshowList :: [FTHybridCombine] -> ShowS
showList :: [FTHybridCombine] -> ShowS
Show, FTHybridCombine -> FTHybridCombine -> Bool
(FTHybridCombine -> FTHybridCombine -> Bool)
-> (FTHybridCombine -> FTHybridCombine -> Bool)
-> Eq FTHybridCombine
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTHybridCombine -> FTHybridCombine -> Bool
== :: FTHybridCombine -> FTHybridCombine -> Bool
$c/= :: FTHybridCombine -> FTHybridCombine -> Bool
/= :: FTHybridCombine -> FTHybridCombine -> Bool
Eq)

data FTHybridSort
    = FTHybridSortBy ByteString (Maybe SortOrder)
    | FTHybridNoSort
    deriving (Int -> FTHybridSort -> ShowS
[FTHybridSort] -> ShowS
FTHybridSort -> String
(Int -> FTHybridSort -> ShowS)
-> (FTHybridSort -> String)
-> ([FTHybridSort] -> ShowS)
-> Show FTHybridSort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTHybridSort -> ShowS
showsPrec :: Int -> FTHybridSort -> ShowS
$cshow :: FTHybridSort -> String
show :: FTHybridSort -> String
$cshowList :: [FTHybridSort] -> ShowS
showList :: [FTHybridSort] -> ShowS
Show, FTHybridSort -> FTHybridSort -> Bool
(FTHybridSort -> FTHybridSort -> Bool)
-> (FTHybridSort -> FTHybridSort -> Bool) -> Eq FTHybridSort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTHybridSort -> FTHybridSort -> Bool
== :: FTHybridSort -> FTHybridSort -> Bool
$c/= :: FTHybridSort -> FTHybridSort -> Bool
/= :: FTHybridSort -> FTHybridSort -> Bool
Eq)

data FTHybridLoad
    = FTHybridLoadFields (NonEmpty ByteString)
    | FTHybridLoadAll
    deriving (Int -> FTHybridLoad -> ShowS
[FTHybridLoad] -> ShowS
FTHybridLoad -> String
(Int -> FTHybridLoad -> ShowS)
-> (FTHybridLoad -> String)
-> ([FTHybridLoad] -> ShowS)
-> Show FTHybridLoad
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTHybridLoad -> ShowS
showsPrec :: Int -> FTHybridLoad -> ShowS
$cshow :: FTHybridLoad -> String
show :: FTHybridLoad -> String
$cshowList :: [FTHybridLoad] -> ShowS
showList :: [FTHybridLoad] -> ShowS
Show, FTHybridLoad -> FTHybridLoad -> Bool
(FTHybridLoad -> FTHybridLoad -> Bool)
-> (FTHybridLoad -> FTHybridLoad -> Bool) -> Eq FTHybridLoad
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTHybridLoad -> FTHybridLoad -> Bool
== :: FTHybridLoad -> FTHybridLoad -> Bool
$c/= :: FTHybridLoad -> FTHybridLoad -> Bool
/= :: FTHybridLoad -> FTHybridLoad -> Bool
Eq)

data FTHybridOpts = FTHybridOpts
    { FTHybridOpts -> Maybe FTHybridCombine
ftHybridCombine :: Maybe FTHybridCombine
    , FTHybridOpts -> Maybe (Integer, Integer)
ftHybridLimit :: Maybe (Integer, Integer)
    , FTHybridOpts -> Maybe FTHybridSort
ftHybridSorting :: Maybe FTHybridSort
    , FTHybridOpts -> [(ByteString, ByteString)]
ftHybridParams :: [(ByteString, ByteString)]
    , FTHybridOpts -> Maybe Integer
ftHybridTimeout :: Maybe Integer
    , FTHybridOpts -> Maybe ByteString
ftHybridFormat :: Maybe ByteString
    , FTHybridOpts -> Maybe FTHybridLoad
ftHybridLoad :: Maybe FTHybridLoad
    , FTHybridOpts -> [FTGroupBy]
ftHybridGroupBy :: [FTGroupBy]
    , FTHybridOpts -> [FTApply]
ftHybridApply :: [FTApply]
    , FTHybridOpts -> Maybe ByteString
ftHybridFilter :: Maybe ByteString
    , FTHybridOpts -> Maybe Integer
ftHybridDialect :: Maybe Integer
    } deriving (Int -> FTHybridOpts -> ShowS
[FTHybridOpts] -> ShowS
FTHybridOpts -> String
(Int -> FTHybridOpts -> ShowS)
-> (FTHybridOpts -> String)
-> ([FTHybridOpts] -> ShowS)
-> Show FTHybridOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTHybridOpts -> ShowS
showsPrec :: Int -> FTHybridOpts -> ShowS
$cshow :: FTHybridOpts -> String
show :: FTHybridOpts -> String
$cshowList :: [FTHybridOpts] -> ShowS
showList :: [FTHybridOpts] -> ShowS
Show, FTHybridOpts -> FTHybridOpts -> Bool
(FTHybridOpts -> FTHybridOpts -> Bool)
-> (FTHybridOpts -> FTHybridOpts -> Bool) -> Eq FTHybridOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTHybridOpts -> FTHybridOpts -> Bool
== :: FTHybridOpts -> FTHybridOpts -> Bool
$c/= :: FTHybridOpts -> FTHybridOpts -> Bool
/= :: FTHybridOpts -> FTHybridOpts -> Bool
Eq)

defaultFTHybridOpts :: FTHybridOpts
defaultFTHybridOpts :: FTHybridOpts
defaultFTHybridOpts = FTHybridOpts
    { ftHybridCombine :: Maybe FTHybridCombine
ftHybridCombine = Maybe FTHybridCombine
forall a. Maybe a
Nothing
    , ftHybridLimit :: Maybe (Integer, Integer)
ftHybridLimit = Maybe (Integer, Integer)
forall a. Maybe a
Nothing
    , ftHybridSorting :: Maybe FTHybridSort
ftHybridSorting = Maybe FTHybridSort
forall a. Maybe a
Nothing
    , ftHybridParams :: [(ByteString, ByteString)]
ftHybridParams = []
    , ftHybridTimeout :: Maybe Integer
ftHybridTimeout = Maybe Integer
forall a. Maybe a
Nothing
    , ftHybridFormat :: Maybe ByteString
ftHybridFormat = Maybe ByteString
forall a. Maybe a
Nothing
    , ftHybridLoad :: Maybe FTHybridLoad
ftHybridLoad = Maybe FTHybridLoad
forall a. Maybe a
Nothing
    , ftHybridGroupBy :: [FTGroupBy]
ftHybridGroupBy = []
    , ftHybridApply :: [FTApply]
ftHybridApply = []
    , ftHybridFilter :: Maybe ByteString
ftHybridFilter = Maybe ByteString
forall a. Maybe a
Nothing
    , ftHybridDialect :: Maybe Integer
ftHybridDialect = Maybe Integer
forall a. Maybe a
Nothing
    }

data FTProfileQueryType
    = FTProfileSearch
    | FTProfileHybrid
    | FTProfileAggregate
    deriving (Int -> FTProfileQueryType -> ShowS
[FTProfileQueryType] -> ShowS
FTProfileQueryType -> String
(Int -> FTProfileQueryType -> ShowS)
-> (FTProfileQueryType -> String)
-> ([FTProfileQueryType] -> ShowS)
-> Show FTProfileQueryType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTProfileQueryType -> ShowS
showsPrec :: Int -> FTProfileQueryType -> ShowS
$cshow :: FTProfileQueryType -> String
show :: FTProfileQueryType -> String
$cshowList :: [FTProfileQueryType] -> ShowS
showList :: [FTProfileQueryType] -> ShowS
Show, FTProfileQueryType -> FTProfileQueryType -> Bool
(FTProfileQueryType -> FTProfileQueryType -> Bool)
-> (FTProfileQueryType -> FTProfileQueryType -> Bool)
-> Eq FTProfileQueryType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTProfileQueryType -> FTProfileQueryType -> Bool
== :: FTProfileQueryType -> FTProfileQueryType -> Bool
$c/= :: FTProfileQueryType -> FTProfileQueryType -> Bool
/= :: FTProfileQueryType -> FTProfileQueryType -> Bool
Eq)

instance RedisArg FTProfileQueryType where
    encode :: FTProfileQueryType -> ByteString
encode FTProfileQueryType
FTProfileSearch = ByteString
"SEARCH"
    encode FTProfileQueryType
FTProfileHybrid = ByteString
"HYBRID"
    encode FTProfileQueryType
FTProfileAggregate = ByteString
"AGGREGATE"

data FTProfileOpts = FTProfileOpts
    { FTProfileOpts -> Bool
ftProfileLimited :: Bool
    } deriving (Int -> FTProfileOpts -> ShowS
[FTProfileOpts] -> ShowS
FTProfileOpts -> String
(Int -> FTProfileOpts -> ShowS)
-> (FTProfileOpts -> String)
-> ([FTProfileOpts] -> ShowS)
-> Show FTProfileOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTProfileOpts -> ShowS
showsPrec :: Int -> FTProfileOpts -> ShowS
$cshow :: FTProfileOpts -> String
show :: FTProfileOpts -> String
$cshowList :: [FTProfileOpts] -> ShowS
showList :: [FTProfileOpts] -> ShowS
Show, FTProfileOpts -> FTProfileOpts -> Bool
(FTProfileOpts -> FTProfileOpts -> Bool)
-> (FTProfileOpts -> FTProfileOpts -> Bool) -> Eq FTProfileOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTProfileOpts -> FTProfileOpts -> Bool
== :: FTProfileOpts -> FTProfileOpts -> Bool
$c/= :: FTProfileOpts -> FTProfileOpts -> Bool
/= :: FTProfileOpts -> FTProfileOpts -> Bool
Eq)

defaultFTProfileOpts :: FTProfileOpts
defaultFTProfileOpts :: FTProfileOpts
defaultFTProfileOpts = FTProfileOpts
    { ftProfileLimited :: Bool
ftProfileLimited = Bool
False
    }

data FTSpellcheckTermsMode
    = FTSpellcheckInclude ByteString [ByteString]
    | FTSpellcheckExclude ByteString [ByteString]
    deriving (Int -> FTSpellcheckTermsMode -> ShowS
[FTSpellcheckTermsMode] -> ShowS
FTSpellcheckTermsMode -> String
(Int -> FTSpellcheckTermsMode -> ShowS)
-> (FTSpellcheckTermsMode -> String)
-> ([FTSpellcheckTermsMode] -> ShowS)
-> Show FTSpellcheckTermsMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSpellcheckTermsMode -> ShowS
showsPrec :: Int -> FTSpellcheckTermsMode -> ShowS
$cshow :: FTSpellcheckTermsMode -> String
show :: FTSpellcheckTermsMode -> String
$cshowList :: [FTSpellcheckTermsMode] -> ShowS
showList :: [FTSpellcheckTermsMode] -> ShowS
Show, FTSpellcheckTermsMode -> FTSpellcheckTermsMode -> Bool
(FTSpellcheckTermsMode -> FTSpellcheckTermsMode -> Bool)
-> (FTSpellcheckTermsMode -> FTSpellcheckTermsMode -> Bool)
-> Eq FTSpellcheckTermsMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSpellcheckTermsMode -> FTSpellcheckTermsMode -> Bool
== :: FTSpellcheckTermsMode -> FTSpellcheckTermsMode -> Bool
$c/= :: FTSpellcheckTermsMode -> FTSpellcheckTermsMode -> Bool
/= :: FTSpellcheckTermsMode -> FTSpellcheckTermsMode -> Bool
Eq)

data FTSpellcheckOpts = FTSpellcheckOpts
    { FTSpellcheckOpts -> Maybe Integer
ftSpellcheckDistance :: Maybe Integer
    , FTSpellcheckOpts -> Maybe FTSpellcheckTermsMode
ftSpellcheckTermsMode :: Maybe FTSpellcheckTermsMode
    , FTSpellcheckOpts -> Maybe Integer
ftSpellcheckDialect :: Maybe Integer
    } deriving (Int -> FTSpellcheckOpts -> ShowS
[FTSpellcheckOpts] -> ShowS
FTSpellcheckOpts -> String
(Int -> FTSpellcheckOpts -> ShowS)
-> (FTSpellcheckOpts -> String)
-> ([FTSpellcheckOpts] -> ShowS)
-> Show FTSpellcheckOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSpellcheckOpts -> ShowS
showsPrec :: Int -> FTSpellcheckOpts -> ShowS
$cshow :: FTSpellcheckOpts -> String
show :: FTSpellcheckOpts -> String
$cshowList :: [FTSpellcheckOpts] -> ShowS
showList :: [FTSpellcheckOpts] -> ShowS
Show, FTSpellcheckOpts -> FTSpellcheckOpts -> Bool
(FTSpellcheckOpts -> FTSpellcheckOpts -> Bool)
-> (FTSpellcheckOpts -> FTSpellcheckOpts -> Bool)
-> Eq FTSpellcheckOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSpellcheckOpts -> FTSpellcheckOpts -> Bool
== :: FTSpellcheckOpts -> FTSpellcheckOpts -> Bool
$c/= :: FTSpellcheckOpts -> FTSpellcheckOpts -> Bool
/= :: FTSpellcheckOpts -> FTSpellcheckOpts -> Bool
Eq)

defaultFTSpellcheckOpts :: FTSpellcheckOpts
defaultFTSpellcheckOpts :: FTSpellcheckOpts
defaultFTSpellcheckOpts = FTSpellcheckOpts
    { ftSpellcheckDistance :: Maybe Integer
ftSpellcheckDistance = Maybe Integer
forall a. Maybe a
Nothing
    , ftSpellcheckTermsMode :: Maybe FTSpellcheckTermsMode
ftSpellcheckTermsMode = Maybe FTSpellcheckTermsMode
forall a. Maybe a
Nothing
    , ftSpellcheckDialect :: Maybe Integer
ftSpellcheckDialect = Maybe Integer
forall a. Maybe a
Nothing
    }

data FTSugAddOpts
    = FTSugAddDefault
    | FTSugAddWithPayload ByteString
    | FTSugAddIncrement
    | FTSugAddIncrementWithPayload ByteString
    deriving (Int -> FTSugAddOpts -> ShowS
[FTSugAddOpts] -> ShowS
FTSugAddOpts -> String
(Int -> FTSugAddOpts -> ShowS)
-> (FTSugAddOpts -> String)
-> ([FTSugAddOpts] -> ShowS)
-> Show FTSugAddOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTSugAddOpts -> ShowS
showsPrec :: Int -> FTSugAddOpts -> ShowS
$cshow :: FTSugAddOpts -> String
show :: FTSugAddOpts -> String
$cshowList :: [FTSugAddOpts] -> ShowS
showList :: [FTSugAddOpts] -> ShowS
Show, FTSugAddOpts -> FTSugAddOpts -> Bool
(FTSugAddOpts -> FTSugAddOpts -> Bool)
-> (FTSugAddOpts -> FTSugAddOpts -> Bool) -> Eq FTSugAddOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTSugAddOpts -> FTSugAddOpts -> Bool
== :: FTSugAddOpts -> FTSugAddOpts -> Bool
$c/= :: FTSugAddOpts -> FTSugAddOpts -> Bool
/= :: FTSugAddOpts -> FTSugAddOpts -> Bool
Eq)

data FTCursorReadOpts = FTCursorReadOpts
    { FTCursorReadOpts -> Maybe Integer
ftCursorReadCount :: Maybe Integer
    } deriving (Int -> FTCursorReadOpts -> ShowS
[FTCursorReadOpts] -> ShowS
FTCursorReadOpts -> String
(Int -> FTCursorReadOpts -> ShowS)
-> (FTCursorReadOpts -> String)
-> ([FTCursorReadOpts] -> ShowS)
-> Show FTCursorReadOpts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> FTCursorReadOpts -> ShowS
showsPrec :: Int -> FTCursorReadOpts -> ShowS
$cshow :: FTCursorReadOpts -> String
show :: FTCursorReadOpts -> String
$cshowList :: [FTCursorReadOpts] -> ShowS
showList :: [FTCursorReadOpts] -> ShowS
Show, FTCursorReadOpts -> FTCursorReadOpts -> Bool
(FTCursorReadOpts -> FTCursorReadOpts -> Bool)
-> (FTCursorReadOpts -> FTCursorReadOpts -> Bool)
-> Eq FTCursorReadOpts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FTCursorReadOpts -> FTCursorReadOpts -> Bool
== :: FTCursorReadOpts -> FTCursorReadOpts -> Bool
$c/= :: FTCursorReadOpts -> FTCursorReadOpts -> Bool
/= :: FTCursorReadOpts -> FTCursorReadOpts -> Bool
Eq)

defaultFTCursorReadOpts :: FTCursorReadOpts
defaultFTCursorReadOpts :: FTCursorReadOpts
defaultFTCursorReadOpts = FTCursorReadOpts
    { ftCursorReadCount :: Maybe Integer
ftCursorReadCount = Maybe Integer
forall a. Maybe a
Nothing
    }

countArgs :: [a] -> ByteString
countArgs :: forall a. [a] -> ByteString
countArgs = Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode (Integer -> ByteString) -> ([a] -> Integer) -> [a] -> ByteString
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral :: Int -> Integer) (Int -> Integer) -> ([a] -> Int) -> [a] -> Integer
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length

fieldIdentifierToArgs :: FTFieldIdentifier -> [ByteString]
fieldIdentifierToArgs :: FTFieldIdentifier -> [ByteString]
fieldIdentifierToArgs (FTFieldName ByteString
name) = [ByteString
name]
fieldIdentifierToArgs (FTFieldNameAs ByteString
name ByteString
alias) = [ByteString
name, ByteString
"AS", ByteString
alias]

sortableToArgs :: FTSortable -> [ByteString]
sortableToArgs :: FTSortable -> [ByteString]
sortableToArgs FTSortable
FTSortable = [ByteString
"SORTABLE"]
sortableToArgs FTSortable
FTSortableUnf = [ByteString
"SORTABLE", ByteString
"UNF"]

commonFieldOptsToArgs :: FTCommonFieldOpts -> [ByteString]
commonFieldOptsToArgs :: FTCommonFieldOpts -> [ByteString]
commonFieldOptsToArgs FTCommonFieldOpts{Bool
Maybe FTSortable
ftCommonFieldWithSuffixTrie :: FTCommonFieldOpts -> Bool
ftCommonFieldIndexEmpty :: FTCommonFieldOpts -> Bool
ftCommonFieldIndexMissing :: FTCommonFieldOpts -> Bool
ftCommonFieldSortable :: FTCommonFieldOpts -> Maybe FTSortable
ftCommonFieldNoIndex :: FTCommonFieldOpts -> Bool
ftCommonFieldWithSuffixTrie :: Bool
ftCommonFieldIndexEmpty :: Bool
ftCommonFieldIndexMissing :: Bool
ftCommonFieldSortable :: Maybe FTSortable
ftCommonFieldNoIndex :: Bool
..} =
    [ByteString]
withSuffixTrieArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
indexEmptyArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
indexMissingArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
sortableArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
noIndexArg
  where
    withSuffixTrieArg :: [ByteString]
withSuffixTrieArg = [ByteString
"WITHSUFFIXTRIE" | Bool
ftCommonFieldWithSuffixTrie]
    indexEmptyArg :: [ByteString]
indexEmptyArg = [ByteString
"INDEXEMPTY" | Bool
ftCommonFieldIndexEmpty]
    indexMissingArg :: [ByteString]
indexMissingArg = [ByteString
"INDEXMISSING" | Bool
ftCommonFieldIndexMissing]
    sortableArg :: [ByteString]
sortableArg = [ByteString]
-> (FTSortable -> [ByteString]) -> Maybe FTSortable -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTSortable -> [ByteString]
sortableToArgs Maybe FTSortable
ftCommonFieldSortable
    noIndexArg :: [ByteString]
noIndexArg = [ByteString
"NOINDEX" | Bool
ftCommonFieldNoIndex]

createFieldToArgs :: FTCreateField -> [ByteString]
createFieldToArgs :: FTCreateField -> [ByteString]
createFieldToArgs FTCreateField
field =
    case FTCreateField
field of
        FTCreateTextField FTFieldIdentifier
identifier FTTextFieldOpts{Bool
Maybe Double
Maybe ByteString
FTCommonFieldOpts
ftTextFieldWeight :: FTTextFieldOpts -> Maybe Double
ftTextFieldNoStem :: FTTextFieldOpts -> Bool
ftTextFieldPhonetic :: FTTextFieldOpts -> Maybe ByteString
ftTextFieldCommonOpts :: FTTextFieldOpts -> FTCommonFieldOpts
ftTextFieldWeight :: Maybe Double
ftTextFieldNoStem :: Bool
ftTextFieldPhonetic :: Maybe ByteString
ftTextFieldCommonOpts :: FTCommonFieldOpts
..} ->
            FTFieldIdentifier -> [ByteString]
fieldIdentifierToArgs FTFieldIdentifier
identifier
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"TEXT"]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (Double -> [ByteString]) -> Maybe Double -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Double
weight -> [ByteString
"WEIGHT", Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
weight]) Maybe Double
ftTextFieldWeight
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"NOSTEM" | Bool
ftTextFieldNoStem]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
matcher -> [ByteString
"PHONETIC", ByteString
matcher]) Maybe ByteString
ftTextFieldPhonetic
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCommonFieldOpts -> [ByteString]
commonFieldOptsToArgs FTCommonFieldOpts
ftTextFieldCommonOpts
        FTCreateTagField FTFieldIdentifier
identifier FTTagFieldOpts{Bool
Maybe ByteString
FTCommonFieldOpts
ftTagFieldSeparator :: FTTagFieldOpts -> Maybe ByteString
ftTagFieldCaseSensitive :: FTTagFieldOpts -> Bool
ftTagFieldCommonOpts :: FTTagFieldOpts -> FTCommonFieldOpts
ftTagFieldSeparator :: Maybe ByteString
ftTagFieldCaseSensitive :: Bool
ftTagFieldCommonOpts :: FTCommonFieldOpts
..} ->
            FTFieldIdentifier -> [ByteString]
fieldIdentifierToArgs FTFieldIdentifier
identifier
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"TAG"]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
separator -> [ByteString
"SEPARATOR", ByteString
separator]) Maybe ByteString
ftTagFieldSeparator
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"CASESENSITIVE" | Bool
ftTagFieldCaseSensitive]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCommonFieldOpts -> [ByteString]
commonFieldOptsToArgs FTCommonFieldOpts
ftTagFieldCommonOpts
        FTCreateNumericField FTFieldIdentifier
identifier FTCommonFieldOpts
opts ->
            FTFieldIdentifier -> [ByteString]
fieldIdentifierToArgs FTFieldIdentifier
identifier [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"NUMERIC"] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCommonFieldOpts -> [ByteString]
commonFieldOptsToArgs FTCommonFieldOpts
opts
        FTCreateGeoField FTFieldIdentifier
identifier FTCommonFieldOpts
opts ->
            FTFieldIdentifier -> [ByteString]
fieldIdentifierToArgs FTFieldIdentifier
identifier [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"GEO"] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCommonFieldOpts -> [ByteString]
commonFieldOptsToArgs FTCommonFieldOpts
opts
        FTCreateGeoShapeField FTFieldIdentifier
identifier FTGeoShapeFieldOpts{Maybe ByteString
FTCommonFieldOpts
ftGeoShapeFieldCoordSystem :: FTGeoShapeFieldOpts -> Maybe ByteString
ftGeoShapeFieldCommonOpts :: FTGeoShapeFieldOpts -> FTCommonFieldOpts
ftGeoShapeFieldCoordSystem :: Maybe ByteString
ftGeoShapeFieldCommonOpts :: FTCommonFieldOpts
..} ->
            FTFieldIdentifier -> [ByteString]
fieldIdentifierToArgs FTFieldIdentifier
identifier
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"GEOSHAPE"]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
coordSystem -> [ByteString
"COORD_SYSTEM", ByteString
coordSystem]) Maybe ByteString
ftGeoShapeFieldCoordSystem
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCommonFieldOpts -> [ByteString]
commonFieldOptsToArgs FTCommonFieldOpts
ftGeoShapeFieldCommonOpts
        FTCreateVectorField FTFieldIdentifier
identifier FTVectorFieldOpts{NonEmpty (ByteString, ByteString)
ByteString
FTCommonFieldOpts
ftVectorFieldAlgorithm :: FTVectorFieldOpts -> ByteString
ftVectorFieldAttributes :: FTVectorFieldOpts -> NonEmpty (ByteString, ByteString)
ftVectorFieldCommonOpts :: FTVectorFieldOpts -> FTCommonFieldOpts
ftVectorFieldAlgorithm :: ByteString
ftVectorFieldAttributes :: NonEmpty (ByteString, ByteString)
ftVectorFieldCommonOpts :: FTCommonFieldOpts
..} ->
            FTFieldIdentifier -> [ByteString]
fieldIdentifierToArgs FTFieldIdentifier
identifier
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ ByteString
"VECTOR"
                   , ByteString
ftVectorFieldAlgorithm
                   , [(ByteString, ByteString)] -> ByteString
forall a. [a] -> ByteString
countArgs (NonEmpty (ByteString, ByteString) -> [(ByteString, ByteString)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (ByteString, ByteString)
ftVectorFieldAttributes)
                   ]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ ((ByteString, ByteString) -> [ByteString])
-> [(ByteString, ByteString)] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(ByteString
name, ByteString
value) -> [ByteString
name, ByteString
value]) (NonEmpty (ByteString, ByteString) -> [(ByteString, ByteString)]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty (ByteString, ByteString)
ftVectorFieldAttributes)
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCommonFieldOpts -> [ByteString]
commonFieldOptsToArgs FTCommonFieldOpts
ftVectorFieldCommonOpts

ftCreateOptsToArgs :: FTCreateOpts -> [ByteString]
ftCreateOptsToArgs :: FTCreateOpts -> [ByteString]
ftCreateOptsToArgs FTCreateOpts{Bool
[ByteString]
Maybe Double
Maybe [ByteString]
Maybe ByteString
Maybe FTIndexAllMode
Maybe FTOn
ftCreateOn :: FTCreateOpts -> Maybe FTOn
ftCreateIndexAll :: FTCreateOpts -> Maybe FTIndexAllMode
ftCreatePrefixes :: FTCreateOpts -> [ByteString]
ftCreateFilter :: FTCreateOpts -> Maybe ByteString
ftCreateLanguage :: FTCreateOpts -> Maybe ByteString
ftCreateLanguageField :: FTCreateOpts -> Maybe ByteString
ftCreateScore :: FTCreateOpts -> Maybe Double
ftCreateScoreField :: FTCreateOpts -> Maybe ByteString
ftCreatePayloadField :: FTCreateOpts -> Maybe ByteString
ftCreateMaxTextFields :: FTCreateOpts -> Bool
ftCreateTemporarySeconds :: FTCreateOpts -> Maybe Double
ftCreateNoOffsets :: FTCreateOpts -> Bool
ftCreateNoHl :: FTCreateOpts -> Bool
ftCreateNoFields :: FTCreateOpts -> Bool
ftCreateNoFreqs :: FTCreateOpts -> Bool
ftCreateStopwords :: FTCreateOpts -> Maybe [ByteString]
ftCreateSkipInitialScan :: FTCreateOpts -> Bool
ftCreateOn :: Maybe FTOn
ftCreateIndexAll :: Maybe FTIndexAllMode
ftCreatePrefixes :: [ByteString]
ftCreateFilter :: Maybe ByteString
ftCreateLanguage :: Maybe ByteString
ftCreateLanguageField :: Maybe ByteString
ftCreateScore :: Maybe Double
ftCreateScoreField :: Maybe ByteString
ftCreatePayloadField :: Maybe ByteString
ftCreateMaxTextFields :: Bool
ftCreateTemporarySeconds :: Maybe Double
ftCreateNoOffsets :: Bool
ftCreateNoHl :: Bool
ftCreateNoFields :: Bool
ftCreateNoFreqs :: Bool
ftCreateStopwords :: Maybe [ByteString]
ftCreateSkipInitialScan :: Bool
..} =
    [ByteString]
onArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
indexAllArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
prefixesArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
filterArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
languageArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
languageFieldArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
scoreArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
scoreFieldArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
payloadFieldArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
maxTextFieldsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
temporaryArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
noOffsetsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
noHlArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
noFieldsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
noFreqsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
stopwordsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
skipInitialScanArg
  where
    onArg :: [ByteString]
onArg = [ByteString]
-> (FTOn -> [ByteString]) -> Maybe FTOn -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\FTOn
dataType -> [ByteString
"ON", FTOn -> ByteString
forall a. RedisArg a => a -> ByteString
encode FTOn
dataType]) Maybe FTOn
ftCreateOn
    indexAllArg :: [ByteString]
indexAllArg = [ByteString]
-> (FTIndexAllMode -> [ByteString])
-> Maybe FTIndexAllMode
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\FTIndexAllMode
mode -> [ByteString
"INDEXALL", FTIndexAllMode -> ByteString
forall a. RedisArg a => a -> ByteString
encode FTIndexAllMode
mode]) Maybe FTIndexAllMode
ftCreateIndexAll
    prefixesArg :: [ByteString]
prefixesArg =
        if [ByteString] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ByteString]
ftCreatePrefixes
            then []
            else [ByteString
"PREFIX", [ByteString] -> ByteString
forall a. [a] -> ByteString
countArgs [ByteString]
ftCreatePrefixes] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
ftCreatePrefixes
    filterArg :: [ByteString]
filterArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
filterExpr -> [ByteString
"FILTER", ByteString
filterExpr]) Maybe ByteString
ftCreateFilter
    languageArg :: [ByteString]
languageArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
lang -> [ByteString
"LANGUAGE", ByteString
lang]) Maybe ByteString
ftCreateLanguage
    languageFieldArg :: [ByteString]
languageFieldArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
field -> [ByteString
"LANGUAGE_FIELD", ByteString
field]) Maybe ByteString
ftCreateLanguageField
    scoreArg :: [ByteString]
scoreArg = [ByteString]
-> (Double -> [ByteString]) -> Maybe Double -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Double
score -> [ByteString
"SCORE", Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
score]) Maybe Double
ftCreateScore
    scoreFieldArg :: [ByteString]
scoreFieldArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
field -> [ByteString
"SCORE_FIELD", ByteString
field]) Maybe ByteString
ftCreateScoreField
    payloadFieldArg :: [ByteString]
payloadFieldArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
field -> [ByteString
"PAYLOAD_FIELD", ByteString
field]) Maybe ByteString
ftCreatePayloadField
    maxTextFieldsArg :: [ByteString]
maxTextFieldsArg = [ByteString
"MAXTEXTFIELDS" | Bool
ftCreateMaxTextFields]
    temporaryArg :: [ByteString]
temporaryArg = [ByteString]
-> (Double -> [ByteString]) -> Maybe Double -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Double
seconds -> [ByteString
"TEMPORARY", Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
seconds]) Maybe Double
ftCreateTemporarySeconds
    noOffsetsArg :: [ByteString]
noOffsetsArg = [ByteString
"NOOFFSETS" | Bool
ftCreateNoOffsets]
    noHlArg :: [ByteString]
noHlArg = [ByteString
"NOHL" | Bool
ftCreateNoHl]
    noFieldsArg :: [ByteString]
noFieldsArg = [ByteString
"NOFIELDS" | Bool
ftCreateNoFields]
    noFreqsArg :: [ByteString]
noFreqsArg = [ByteString
"NOFREQS" | Bool
ftCreateNoFreqs]
    stopwordsArg :: [ByteString]
stopwordsArg = [ByteString]
-> ([ByteString] -> [ByteString])
-> Maybe [ByteString]
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\[ByteString]
words' -> [ByteString
"STOPWORDS", [ByteString] -> ByteString
forall a. [a] -> ByteString
countArgs [ByteString]
words'] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
words') Maybe [ByteString]
ftCreateStopwords
    skipInitialScanArg :: [ByteString]
skipInitialScanArg = [ByteString
"SKIPINITIALSCAN" | Bool
ftCreateSkipInitialScan]

ftAlterOptsToArgs :: FTAlterOpts -> [ByteString]
ftAlterOptsToArgs :: FTAlterOpts -> [ByteString]
ftAlterOptsToArgs FTAlterOpts{Bool
ftAlterSkipInitialScan :: FTAlterOpts -> Bool
ftAlterSkipInitialScan :: Bool
..} =
    [ByteString
"SKIPINITIALSCAN" | Bool
ftAlterSkipInitialScan]

ftExplainOptsToArgs :: FTExplainOpts -> [ByteString]
ftExplainOptsToArgs :: FTExplainOpts -> [ByteString]
ftExplainOptsToArgs FTExplainOpts{Maybe Integer
ftExplainDialect :: FTExplainOpts -> Maybe Integer
ftExplainDialect :: Maybe Integer
..} =
    [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
dialect -> [ByteString
"DIALECT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
dialect]) Maybe Integer
ftExplainDialect

returnFieldToArgs :: FTReturnField -> [ByteString]
returnFieldToArgs :: FTReturnField -> [ByteString]
returnFieldToArgs (FTReturnField ByteString
identifier) = [ByteString
identifier]
returnFieldToArgs (FTReturnFieldAs ByteString
identifier ByteString
alias) = [ByteString
identifier, ByteString
"AS", ByteString
alias]

summarizeOptsToArgs :: FTSummarizeOpts -> [ByteString]
summarizeOptsToArgs :: FTSummarizeOpts -> [ByteString]
summarizeOptsToArgs FTSummarizeOpts{[ByteString]
Maybe Integer
Maybe ByteString
ftSummarizeFields :: FTSummarizeOpts -> [ByteString]
ftSummarizeFrags :: FTSummarizeOpts -> Maybe Integer
ftSummarizeLen :: FTSummarizeOpts -> Maybe Integer
ftSummarizeSeparator :: FTSummarizeOpts -> Maybe ByteString
ftSummarizeFields :: [ByteString]
ftSummarizeFrags :: Maybe Integer
ftSummarizeLen :: Maybe Integer
ftSummarizeSeparator :: Maybe ByteString
..} =
    [ByteString
"SUMMARIZE"]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
fieldsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
fragsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
lenArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
separatorArg
  where
    fieldsArg :: [ByteString]
fieldsArg =
        if [ByteString] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ByteString]
ftSummarizeFields
            then []
            else [ByteString
"FIELDS", [ByteString] -> ByteString
forall a. [a] -> ByteString
countArgs [ByteString]
ftSummarizeFields] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
ftSummarizeFields
    fragsArg :: [ByteString]
fragsArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
frags -> [ByteString
"FRAGS", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
frags]) Maybe Integer
ftSummarizeFrags
    lenArg :: [ByteString]
lenArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
len -> [ByteString
"LEN", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
len]) Maybe Integer
ftSummarizeLen
    separatorArg :: [ByteString]
separatorArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
separator -> [ByteString
"SEPARATOR", ByteString
separator]) Maybe ByteString
ftSummarizeSeparator

highlightOptsToArgs :: FTHighlightOpts -> [ByteString]
highlightOptsToArgs :: FTHighlightOpts -> [ByteString]
highlightOptsToArgs FTHighlightOpts{[ByteString]
Maybe (ByteString, ByteString)
ftHighlightFields :: FTHighlightOpts -> [ByteString]
ftHighlightTags :: FTHighlightOpts -> Maybe (ByteString, ByteString)
ftHighlightFields :: [ByteString]
ftHighlightTags :: Maybe (ByteString, ByteString)
..} =
    [ByteString
"HIGHLIGHT"] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
fieldsArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
tagsArg
  where
    fieldsArg :: [ByteString]
fieldsArg =
        if [ByteString] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ByteString]
ftHighlightFields
            then []
            else [ByteString
"FIELDS", [ByteString] -> ByteString
forall a. [a] -> ByteString
countArgs [ByteString]
ftHighlightFields] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
ftHighlightFields
    tagsArg :: [ByteString]
tagsArg = [ByteString]
-> ((ByteString, ByteString) -> [ByteString])
-> Maybe (ByteString, ByteString)
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(ByteString
openTag, ByteString
closeTag) -> [ByteString
"TAGS", ByteString
openTag, ByteString
closeTag]) Maybe (ByteString, ByteString)
ftHighlightTags

numericFilterToArgs :: FTNumericFilter -> [ByteString]
numericFilterToArgs :: FTNumericFilter -> [ByteString]
numericFilterToArgs FTNumericFilter{Double
ByteString
ftNumericFilterField :: FTNumericFilter -> ByteString
ftNumericFilterMin :: FTNumericFilter -> Double
ftNumericFilterMax :: FTNumericFilter -> Double
ftNumericFilterField :: ByteString
ftNumericFilterMin :: Double
ftNumericFilterMax :: Double
..} =
    [ ByteString
"FILTER"
    , ByteString
ftNumericFilterField
    , Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
ftNumericFilterMin
    , Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
ftNumericFilterMax
    ]

geoFilterToArgs :: FTGeoFilter -> [ByteString]
geoFilterToArgs :: FTGeoFilter -> [ByteString]
geoFilterToArgs FTGeoFilter{Double
ByteString
GeoUnit
ftGeoFilterField :: FTGeoFilter -> ByteString
ftGeoFilterLongitude :: FTGeoFilter -> Double
ftGeoFilterLatitude :: FTGeoFilter -> Double
ftGeoFilterRadius :: FTGeoFilter -> Double
ftGeoFilterUnit :: FTGeoFilter -> GeoUnit
ftGeoFilterField :: ByteString
ftGeoFilterLongitude :: Double
ftGeoFilterLatitude :: Double
ftGeoFilterRadius :: Double
ftGeoFilterUnit :: GeoUnit
..} =
    [ ByteString
"GEOFILTER"
    , ByteString
ftGeoFilterField
    , Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
ftGeoFilterLongitude
    , Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
ftGeoFilterLatitude
    , Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
ftGeoFilterRadius
    , GeoUnit -> ByteString
forall a. RedisArg a => a -> ByteString
encode GeoUnit
ftGeoFilterUnit
    ]

sortByToArgs :: FTSortBy -> [ByteString]
sortByToArgs :: FTSortBy -> [ByteString]
sortByToArgs FTSortBy{Maybe SortOrder
ByteString
ftSortByField :: FTSortBy -> ByteString
ftSortByOrder :: FTSortBy -> Maybe SortOrder
ftSortByField :: ByteString
ftSortByOrder :: Maybe SortOrder
..} =
    [ByteString
"SORTBY", ByteString
ftSortByField] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (SortOrder -> [ByteString]) -> Maybe SortOrder -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\SortOrder
order -> [SortOrder -> ByteString
forall {a}. IsString a => SortOrder -> a
encodeSortOrder SortOrder
order]) Maybe SortOrder
ftSortByOrder
  where
    encodeSortOrder :: SortOrder -> a
encodeSortOrder SortOrder
Asc = a
"ASC"
    encodeSortOrder SortOrder
Desc = a
"DESC"

ftSearchOptsToArgs :: FTSearchOpts -> [ByteString]
ftSearchOptsToArgs :: FTSearchOpts -> [ByteString]
ftSearchOptsToArgs FTSearchOpts{Bool
[(ByteString, ByteString)]
[ByteString]
[FTGeoFilter]
[FTNumericFilter]
[FTReturnField]
Maybe Integer
Maybe (Integer, Integer)
Maybe ByteString
Maybe FTSortBy
Maybe FTHighlightOpts
Maybe FTSummarizeOpts
FTSearchSortKeysMode
FTSearchPayloadMode
FTSearchScoreMode
FTSearchContentMode
ftSearchContentMode :: FTSearchOpts -> FTSearchContentMode
ftSearchVerbatim :: FTSearchOpts -> Bool
ftSearchNoStopWords :: FTSearchOpts -> Bool
ftSearchScoreMode :: FTSearchOpts -> FTSearchScoreMode
ftSearchPayloadMode :: FTSearchOpts -> FTSearchPayloadMode
ftSearchSortKeysMode :: FTSearchOpts -> FTSearchSortKeysMode
ftSearchNumericFilters :: FTSearchOpts -> [FTNumericFilter]
ftSearchGeoFilters :: FTSearchOpts -> [FTGeoFilter]
ftSearchInKeys :: FTSearchOpts -> [ByteString]
ftSearchInFields :: FTSearchOpts -> [ByteString]
ftSearchReturnFields :: FTSearchOpts -> [FTReturnField]
ftSearchSummarize :: FTSearchOpts -> Maybe FTSummarizeOpts
ftSearchHighlight :: FTSearchOpts -> Maybe FTHighlightOpts
ftSearchSlop :: FTSearchOpts -> Maybe Integer
ftSearchTimeout :: FTSearchOpts -> Maybe Integer
ftSearchInOrder :: FTSearchOpts -> Bool
ftSearchLanguage :: FTSearchOpts -> Maybe ByteString
ftSearchExpander :: FTSearchOpts -> Maybe ByteString
ftSearchScorer :: FTSearchOpts -> Maybe ByteString
ftSearchPayload :: FTSearchOpts -> Maybe ByteString
ftSearchSortBy :: FTSearchOpts -> Maybe FTSortBy
ftSearchLimit :: FTSearchOpts -> Maybe (Integer, Integer)
ftSearchParams :: FTSearchOpts -> [(ByteString, ByteString)]
ftSearchDialect :: FTSearchOpts -> Maybe Integer
ftSearchContentMode :: FTSearchContentMode
ftSearchVerbatim :: Bool
ftSearchNoStopWords :: Bool
ftSearchScoreMode :: FTSearchScoreMode
ftSearchPayloadMode :: FTSearchPayloadMode
ftSearchSortKeysMode :: FTSearchSortKeysMode
ftSearchNumericFilters :: [FTNumericFilter]
ftSearchGeoFilters :: [FTGeoFilter]
ftSearchInKeys :: [ByteString]
ftSearchInFields :: [ByteString]
ftSearchReturnFields :: [FTReturnField]
ftSearchSummarize :: Maybe FTSummarizeOpts
ftSearchHighlight :: Maybe FTHighlightOpts
ftSearchSlop :: Maybe Integer
ftSearchTimeout :: Maybe Integer
ftSearchInOrder :: Bool
ftSearchLanguage :: Maybe ByteString
ftSearchExpander :: Maybe ByteString
ftSearchScorer :: Maybe ByteString
ftSearchPayload :: Maybe ByteString
ftSearchSortBy :: Maybe FTSortBy
ftSearchLimit :: Maybe (Integer, Integer)
ftSearchParams :: [(ByteString, ByteString)]
ftSearchDialect :: Maybe Integer
..} =
    [ByteString]
contentArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
verbatimArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
noStopWordsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
scoreArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
payloadsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
sortKeysArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTNumericFilter -> [ByteString])
-> [FTNumericFilter] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTNumericFilter -> [ByteString]
numericFilterToArgs [FTNumericFilter]
ftSearchNumericFilters
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTGeoFilter -> [ByteString]) -> [FTGeoFilter] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTGeoFilter -> [ByteString]
geoFilterToArgs [FTGeoFilter]
ftSearchGeoFilters
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
inKeysArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
inFieldsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
returnArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (FTSummarizeOpts -> [ByteString])
-> Maybe FTSummarizeOpts
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTSummarizeOpts -> [ByteString]
summarizeOptsToArgs Maybe FTSummarizeOpts
ftSearchSummarize
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (FTHighlightOpts -> [ByteString])
-> Maybe FTHighlightOpts
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTHighlightOpts -> [ByteString]
highlightOptsToArgs Maybe FTHighlightOpts
ftSearchHighlight
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
slopArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
timeoutArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
inOrderArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
languageArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
expanderArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
scorerArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
payloadArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
sortByArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
limitArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
paramsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
dialectArg
  where
    contentArg :: [ByteString]
contentArg = [ByteString
"NOCONTENT" | FTSearchContentMode
ftSearchContentMode FTSearchContentMode -> FTSearchContentMode -> Bool
forall a. Eq a => a -> a -> Bool
== FTSearchContentMode
FTSearchReturnIdsOnly]
    verbatimArg :: [ByteString]
verbatimArg = [ByteString
"VERBATIM" | Bool
ftSearchVerbatim]
    noStopWordsArg :: [ByteString]
noStopWordsArg = [ByteString
"NOSTOPWORDS" | Bool
ftSearchNoStopWords]
    scoreArg :: [ByteString]
scoreArg = case FTSearchScoreMode
ftSearchScoreMode of
        FTSearchScoreMode
FTSearchNoScores -> []
        FTSearchScoreMode
FTSearchWithScores -> [ByteString
"WITHSCORES"]
        FTSearchScoreMode
FTSearchWithExplainScore -> [ByteString
"WITHSCORES", ByteString
"EXPLAINSCORE"]
    payloadsArg :: [ByteString]
payloadsArg = [ByteString
"WITHPAYLOADS" | FTSearchPayloadMode
ftSearchPayloadMode FTSearchPayloadMode -> FTSearchPayloadMode -> Bool
forall a. Eq a => a -> a -> Bool
== FTSearchPayloadMode
FTSearchWithPayloads]
    sortKeysArg :: [ByteString]
sortKeysArg = [ByteString
"WITHSORTKEYS" | FTSearchSortKeysMode
ftSearchSortKeysMode FTSearchSortKeysMode -> FTSearchSortKeysMode -> Bool
forall a. Eq a => a -> a -> Bool
== FTSearchSortKeysMode
FTSearchWithSortKeys]
    inKeysArg :: [ByteString]
inKeysArg =
        if [ByteString] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ByteString]
ftSearchInKeys
            then []
            else [ByteString
"INKEYS", [ByteString] -> ByteString
forall a. [a] -> ByteString
countArgs [ByteString]
ftSearchInKeys] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
ftSearchInKeys
    inFieldsArg :: [ByteString]
inFieldsArg =
        if [ByteString] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [ByteString]
ftSearchInFields
            then []
            else [ByteString
"INFIELDS", [ByteString] -> ByteString
forall a. [a] -> ByteString
countArgs [ByteString]
ftSearchInFields] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
ftSearchInFields
    returnArg :: [ByteString]
returnArg =
        if [FTReturnField] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [FTReturnField]
ftSearchReturnFields
            then []
            else [ByteString
"RETURN", [FTReturnField] -> ByteString
forall a. [a] -> ByteString
countArgs [FTReturnField]
ftSearchReturnFields] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTReturnField -> [ByteString]) -> [FTReturnField] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTReturnField -> [ByteString]
returnFieldToArgs [FTReturnField]
ftSearchReturnFields
    slopArg :: [ByteString]
slopArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
slop -> [ByteString
"SLOP", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
slop]) Maybe Integer
ftSearchSlop
    timeoutArg :: [ByteString]
timeoutArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
timeout -> [ByteString
"TIMEOUT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
timeout]) Maybe Integer
ftSearchTimeout
    inOrderArg :: [ByteString]
inOrderArg = [ByteString
"INORDER" | Bool
ftSearchInOrder]
    languageArg :: [ByteString]
languageArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
language -> [ByteString
"LANGUAGE", ByteString
language]) Maybe ByteString
ftSearchLanguage
    expanderArg :: [ByteString]
expanderArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
expander -> [ByteString
"EXPANDER", ByteString
expander]) Maybe ByteString
ftSearchExpander
    scorerArg :: [ByteString]
scorerArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
scorer -> [ByteString
"SCORER", ByteString
scorer]) Maybe ByteString
ftSearchScorer
    payloadArg :: [ByteString]
payloadArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
payload -> [ByteString
"PAYLOAD", ByteString
payload]) Maybe ByteString
ftSearchPayload
    sortByArg :: [ByteString]
sortByArg = [ByteString]
-> (FTSortBy -> [ByteString]) -> Maybe FTSortBy -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTSortBy -> [ByteString]
sortByToArgs Maybe FTSortBy
ftSearchSortBy
    limitArg :: [ByteString]
limitArg = [ByteString]
-> ((Integer, Integer) -> [ByteString])
-> Maybe (Integer, Integer)
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(Integer
offset, Integer
num) -> [ByteString
"LIMIT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
offset, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
num]) Maybe (Integer, Integer)
ftSearchLimit
    paramsArg :: [ByteString]
paramsArg =
        if [(ByteString, ByteString)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(ByteString, ByteString)]
ftSearchParams
            then []
            else [ByteString
"PARAMS", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode (Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
2 Int -> Int -> Int
forall a. Num a => a -> a -> a
* [(ByteString, ByteString)] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(ByteString, ByteString)]
ftSearchParams) :: Integer)]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ ((ByteString, ByteString) -> [ByteString])
-> [(ByteString, ByteString)] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(ByteString
name, ByteString
value) -> [ByteString
name, ByteString
value]) [(ByteString, ByteString)]
ftSearchParams
    dialectArg :: [ByteString]
dialectArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
dialect -> [ByteString
"DIALECT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
dialect]) Maybe Integer
ftSearchDialect

aggregateLoadToArgs :: FTAggregateLoad -> [ByteString]
aggregateLoadToArgs :: FTAggregateLoad -> [ByteString]
aggregateLoadToArgs FTAggregateLoad
FTAggregateLoadAll = [ByteString
"LOAD", ByteString
"*"]
aggregateLoadToArgs (FTAggregateLoadFields NonEmpty ByteString
fields) =
    [ByteString
"LOAD", [ByteString] -> ByteString
forall a. [a] -> ByteString
countArgs (NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
fields)] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
fields

sortPropertyToArgs :: FTSortProperty -> [ByteString]
sortPropertyToArgs :: FTSortProperty -> [ByteString]
sortPropertyToArgs FTSortProperty{Maybe SortOrder
ByteString
ftSortPropertyName :: FTSortProperty -> ByteString
ftSortPropertyOrder :: FTSortProperty -> Maybe SortOrder
ftSortPropertyName :: ByteString
ftSortPropertyOrder :: Maybe SortOrder
..} =
    [ByteString
ftSortPropertyName] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (SortOrder -> [ByteString]) -> Maybe SortOrder -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\SortOrder
order -> [SortOrder -> ByteString
forall {a}. IsString a => SortOrder -> a
encodeSortOrder SortOrder
order]) Maybe SortOrder
ftSortPropertyOrder
  where
    encodeSortOrder :: SortOrder -> a
encodeSortOrder SortOrder
Asc = a
"ASC"
    encodeSortOrder SortOrder
Desc = a
"DESC"

reduceToArgs :: FTReduce -> [ByteString]
reduceToArgs :: FTReduce -> [ByteString]
reduceToArgs FTReduce{[ByteString]
Maybe ByteString
ByteString
ftReduceFunction :: FTReduce -> ByteString
ftReduceArgs :: FTReduce -> [ByteString]
ftReduceAlias :: FTReduce -> Maybe ByteString
ftReduceFunction :: ByteString
ftReduceArgs :: [ByteString]
ftReduceAlias :: Maybe ByteString
..} =
    [ ByteString
"REDUCE"
    , ByteString
ftReduceFunction
    , Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode (Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral ([ByteString] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [ByteString]
ftReduceArgs) :: Integer)
    ]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
ftReduceArgs
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
alias -> [ByteString
"AS", ByteString
alias]) Maybe ByteString
ftReduceAlias

groupByToArgs :: FTGroupBy -> [ByteString]
groupByToArgs :: FTGroupBy -> [ByteString]
groupByToArgs FTGroupBy{[FTReduce]
NonEmpty ByteString
ftGroupByProperties :: FTGroupBy -> NonEmpty ByteString
ftGroupByReducers :: FTGroupBy -> [FTReduce]
ftGroupByProperties :: NonEmpty ByteString
ftGroupByReducers :: [FTReduce]
..} =
    [ ByteString
"GROUPBY"
    , Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode (Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (NonEmpty ByteString -> Int
forall a. NonEmpty a -> Int
NE.length NonEmpty ByteString
ftGroupByProperties) :: Integer)
    ]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
ftGroupByProperties
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTReduce -> [ByteString]) -> [FTReduce] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTReduce -> [ByteString]
reduceToArgs [FTReduce]
ftGroupByReducers

applyToArgs :: FTApply -> [ByteString]
applyToArgs :: FTApply -> [ByteString]
applyToArgs FTApply{Maybe ByteString
ByteString
ftApplyExpression :: FTApply -> ByteString
ftApplyAlias :: FTApply -> Maybe ByteString
ftApplyExpression :: ByteString
ftApplyAlias :: Maybe ByteString
..} =
    [ByteString
"APPLY", ByteString
ftApplyExpression] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
alias -> [ByteString
"AS", ByteString
alias]) Maybe ByteString
ftApplyAlias

cursorOptsToArgs :: FTCursorOpts -> [ByteString]
cursorOptsToArgs :: FTCursorOpts -> [ByteString]
cursorOptsToArgs FTCursorOpts{Maybe Integer
ftCursorCount :: FTCursorOpts -> Maybe Integer
ftCursorMaxIdle :: FTCursorOpts -> Maybe Integer
ftCursorCount :: Maybe Integer
ftCursorMaxIdle :: Maybe Integer
..} =
    [ByteString
"WITHCURSOR"] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
countArg [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
maxIdleArg
  where
    countArg :: [ByteString]
countArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
count -> [ByteString
"COUNT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
count]) Maybe Integer
ftCursorCount
    maxIdleArg :: [ByteString]
maxIdleArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
maxIdle -> [ByteString
"MAXIDLE", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
maxIdle]) Maybe Integer
ftCursorMaxIdle

ftAggregateOptsToArgs :: FTAggregateOpts -> [ByteString]
ftAggregateOptsToArgs :: FTAggregateOpts -> [ByteString]
ftAggregateOptsToArgs FTAggregateOpts{Bool
[(ByteString, ByteString)]
[FTApply]
[FTGroupBy]
Maybe Integer
Maybe (Integer, Integer)
Maybe (NonEmpty FTSortProperty, Maybe Integer)
Maybe ByteString
Maybe FTCursorOpts
Maybe FTAggregateLoad
ftAggregateVerbatim :: FTAggregateOpts -> Bool
ftAggregateLoad :: FTAggregateOpts -> Maybe FTAggregateLoad
ftAggregateTimeout :: FTAggregateOpts -> Maybe Integer
ftAggregateGroupBy :: FTAggregateOpts -> [FTGroupBy]
ftAggregateSortBy :: FTAggregateOpts -> Maybe (NonEmpty FTSortProperty, Maybe Integer)
ftAggregateApply :: FTAggregateOpts -> [FTApply]
ftAggregateLimit :: FTAggregateOpts -> Maybe (Integer, Integer)
ftAggregateFilter :: FTAggregateOpts -> Maybe ByteString
ftAggregateCursor :: FTAggregateOpts -> Maybe FTCursorOpts
ftAggregateParams :: FTAggregateOpts -> [(ByteString, ByteString)]
ftAggregateDialect :: FTAggregateOpts -> Maybe Integer
ftAggregateVerbatim :: Bool
ftAggregateLoad :: Maybe FTAggregateLoad
ftAggregateTimeout :: Maybe Integer
ftAggregateGroupBy :: [FTGroupBy]
ftAggregateSortBy :: Maybe (NonEmpty FTSortProperty, Maybe Integer)
ftAggregateApply :: [FTApply]
ftAggregateLimit :: Maybe (Integer, Integer)
ftAggregateFilter :: Maybe ByteString
ftAggregateCursor :: Maybe FTCursorOpts
ftAggregateParams :: [(ByteString, ByteString)]
ftAggregateDialect :: Maybe Integer
..} =
    [ByteString]
verbatimArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (FTAggregateLoad -> [ByteString])
-> Maybe FTAggregateLoad
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTAggregateLoad -> [ByteString]
aggregateLoadToArgs Maybe FTAggregateLoad
ftAggregateLoad
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
timeoutArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTGroupBy -> [ByteString]) -> [FTGroupBy] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTGroupBy -> [ByteString]
groupByToArgs [FTGroupBy]
ftAggregateGroupBy
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
sortByArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTApply -> [ByteString]) -> [FTApply] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTApply -> [ByteString]
applyToArgs [FTApply]
ftAggregateApply
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
limitArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
filterArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (FTCursorOpts -> [ByteString])
-> Maybe FTCursorOpts
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTCursorOpts -> [ByteString]
cursorOptsToArgs Maybe FTCursorOpts
ftAggregateCursor
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
paramsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
dialectArg
  where
    verbatimArg :: [ByteString]
verbatimArg = [ByteString
"VERBATIM" | Bool
ftAggregateVerbatim]
    timeoutArg :: [ByteString]
timeoutArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
timeout -> [ByteString
"TIMEOUT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
timeout]) Maybe Integer
ftAggregateTimeout
    sortByArg :: [ByteString]
sortByArg = [ByteString]
-> ((NonEmpty FTSortProperty, Maybe Integer) -> [ByteString])
-> Maybe (NonEmpty FTSortProperty, Maybe Integer)
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (NonEmpty FTSortProperty, Maybe Integer) -> [ByteString]
forall {a}.
RedisArg a =>
(NonEmpty FTSortProperty, Maybe a) -> [ByteString]
encodeSortBy Maybe (NonEmpty FTSortProperty, Maybe Integer)
ftAggregateSortBy
    encodeSortBy :: (NonEmpty FTSortProperty, Maybe a) -> [ByteString]
encodeSortBy (NonEmpty FTSortProperty
properties, Maybe a
maxResults) =
        [ ByteString
"SORTBY"
        , Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode (Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (NonEmpty FTSortProperty -> Int
forall a. NonEmpty a -> Int
NE.length NonEmpty FTSortProperty
properties) :: Integer)
        ]
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTSortProperty -> [ByteString])
-> [FTSortProperty] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTSortProperty -> [ByteString]
sortPropertyToArgs (NonEmpty FTSortProperty -> [FTSortProperty]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty FTSortProperty
properties)
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString] -> (a -> [ByteString]) -> Maybe a -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\a
max' -> [ByteString
"MAX", a -> ByteString
forall a. RedisArg a => a -> ByteString
encode a
max']) Maybe a
maxResults
    limitArg :: [ByteString]
limitArg = [ByteString]
-> ((Integer, Integer) -> [ByteString])
-> Maybe (Integer, Integer)
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(Integer
offset, Integer
num) -> [ByteString
"LIMIT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
offset, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
num]) Maybe (Integer, Integer)
ftAggregateLimit
    filterArg :: [ByteString]
filterArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
expr -> [ByteString
"FILTER", ByteString
expr]) Maybe ByteString
ftAggregateFilter
    paramsArg :: [ByteString]
paramsArg =
        if [(ByteString, ByteString)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(ByteString, ByteString)]
ftAggregateParams
            then []
            else [ByteString
"PARAMS", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode (Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
2 Int -> Int -> Int
forall a. Num a => a -> a -> a
* [(ByteString, ByteString)] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(ByteString, ByteString)]
ftAggregateParams) :: Integer)]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ ((ByteString, ByteString) -> [ByteString])
-> [(ByteString, ByteString)] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(ByteString
name, ByteString
value) -> [ByteString
name, ByteString
value]) [(ByteString, ByteString)]
ftAggregateParams
    dialectArg :: [ByteString]
dialectArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
dialect -> [ByteString
"DIALECT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
dialect]) Maybe Integer
ftAggregateDialect

hybridVectorQueryToArgs :: FTHybridVectorQuery -> [ByteString]
hybridVectorQueryToArgs :: FTHybridVectorQuery -> [ByteString]
hybridVectorQueryToArgs FTHybridKnn{Integer
Maybe Integer
Maybe ByteString
ftHybridKnnCount :: FTHybridVectorQuery -> Integer
ftHybridKnnK :: FTHybridVectorQuery -> Integer
ftHybridKnnEfRuntime :: FTHybridVectorQuery -> Maybe Integer
ftHybridKnnYieldScoreAs :: FTHybridVectorQuery -> Maybe ByteString
ftHybridKnnCount :: Integer
ftHybridKnnK :: Integer
ftHybridKnnEfRuntime :: Maybe Integer
ftHybridKnnYieldScoreAs :: Maybe ByteString
..} =
    [ ByteString
"KNN"
    , Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
ftHybridKnnCount
    , ByteString
"K"
    , Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
ftHybridKnnK
    ]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
efRuntime -> [ByteString
"EF_RUNTIME", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
efRuntime]) Maybe Integer
ftHybridKnnEfRuntime
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
name -> [ByteString
"YIELD_SCORE_AS", ByteString
name]) Maybe ByteString
ftHybridKnnYieldScoreAs
hybridVectorQueryToArgs FTHybridRange{Double
Integer
Maybe Double
Maybe ByteString
ftHybridRangeCount :: FTHybridVectorQuery -> Integer
ftHybridRangeRadius :: FTHybridVectorQuery -> Double
ftHybridRangeEpsilon :: FTHybridVectorQuery -> Maybe Double
ftHybridRangeYieldScoreAs :: FTHybridVectorQuery -> Maybe ByteString
ftHybridRangeCount :: Integer
ftHybridRangeRadius :: Double
ftHybridRangeEpsilon :: Maybe Double
ftHybridRangeYieldScoreAs :: Maybe ByteString
..} =
    [ ByteString
"RANGE"
    , Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
ftHybridRangeCount
    , ByteString
"RADIUS"
    , Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
ftHybridRangeRadius
    ]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (Double -> [ByteString]) -> Maybe Double -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Double
epsilon -> [ByteString
"EPSILON", Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
epsilon]) Maybe Double
ftHybridRangeEpsilon
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
name -> [ByteString
"YIELD_SCORE_AS", ByteString
name]) Maybe ByteString
ftHybridRangeYieldScoreAs

hybridSearchClauseToArgs :: FTHybridSearchClause -> [ByteString]
hybridSearchClauseToArgs :: FTHybridSearchClause -> [ByteString]
hybridSearchClauseToArgs FTHybridSearchClause{Maybe ByteString
ByteString
ftHybridSearchQuery :: FTHybridSearchClause -> ByteString
ftHybridSearchScorer :: FTHybridSearchClause -> Maybe ByteString
ftHybridSearchYieldScoreAs :: FTHybridSearchClause -> Maybe ByteString
ftHybridSearchQuery :: ByteString
ftHybridSearchScorer :: Maybe ByteString
ftHybridSearchYieldScoreAs :: Maybe ByteString
..} =
    [ ByteString
"SEARCH"
    , ByteString
ftHybridSearchQuery
    ]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
scorer -> [ByteString
"SCORER", ByteString
scorer]) Maybe ByteString
ftHybridSearchScorer
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
name -> [ByteString
"YIELD_SCORE_AS", ByteString
name]) Maybe ByteString
ftHybridSearchYieldScoreAs

hybridVSimClauseToArgs :: FTHybridVSimClause -> [ByteString]
hybridVSimClauseToArgs :: FTHybridVSimClause -> [ByteString]
hybridVSimClauseToArgs FTHybridVSimClause{Maybe ByteString
Maybe FTHybridVectorQuery
ByteString
ftHybridVSimField :: FTHybridVSimClause -> ByteString
ftHybridVSimVector :: FTHybridVSimClause -> ByteString
ftHybridVSimQuery :: FTHybridVSimClause -> Maybe FTHybridVectorQuery
ftHybridVSimFilter :: FTHybridVSimClause -> Maybe ByteString
ftHybridVSimField :: ByteString
ftHybridVSimVector :: ByteString
ftHybridVSimQuery :: Maybe FTHybridVectorQuery
ftHybridVSimFilter :: Maybe ByteString
..} =
    [ ByteString
"VSIM"
    , ByteString
ftHybridVSimField
    , ByteString
ftHybridVSimVector
    ]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (FTHybridVectorQuery -> [ByteString])
-> Maybe FTHybridVectorQuery
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTHybridVectorQuery -> [ByteString]
hybridVectorQueryToArgs Maybe FTHybridVectorQuery
ftHybridVSimQuery
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
expr -> [ByteString
"FILTER", ByteString
expr]) Maybe ByteString
ftHybridVSimFilter

hybridCombineToArgs :: FTHybridCombine -> [ByteString]
hybridCombineToArgs :: FTHybridCombine -> [ByteString]
hybridCombineToArgs FTHybridCombineRRF{Integer
Maybe Double
Maybe Integer
Maybe ByteString
ftHybridRrfCount :: FTHybridCombine -> Integer
ftHybridRrfConstant :: FTHybridCombine -> Maybe Double
ftHybridRrfWindow :: FTHybridCombine -> Maybe Integer
ftHybridRrfYieldScoreAs :: FTHybridCombine -> Maybe ByteString
ftHybridRrfCount :: Integer
ftHybridRrfConstant :: Maybe Double
ftHybridRrfWindow :: Maybe Integer
ftHybridRrfYieldScoreAs :: Maybe ByteString
..} =
    [ ByteString
"COMBINE"
    , ByteString
"RRF"
    , Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
ftHybridRrfCount
    ]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (Double -> [ByteString]) -> Maybe Double -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Double
constant -> [ByteString
"CONSTANT", Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
constant]) Maybe Double
ftHybridRrfConstant
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
window -> [ByteString
"WINDOW", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
window]) Maybe Integer
ftHybridRrfWindow
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
name -> [ByteString
"YIELD_SCORE_AS", ByteString
name]) Maybe ByteString
ftHybridRrfYieldScoreAs
hybridCombineToArgs FTHybridCombineLinear{Integer
Maybe Integer
Maybe (Double, Double)
Maybe ByteString
ftHybridLinearCount :: FTHybridCombine -> Integer
ftHybridLinearAlphaBeta :: FTHybridCombine -> Maybe (Double, Double)
ftHybridLinearWindow :: FTHybridCombine -> Maybe Integer
ftHybridLinearYieldScoreAs :: FTHybridCombine -> Maybe ByteString
ftHybridLinearCount :: Integer
ftHybridLinearAlphaBeta :: Maybe (Double, Double)
ftHybridLinearWindow :: Maybe Integer
ftHybridLinearYieldScoreAs :: Maybe ByteString
..} =
    [ ByteString
"COMBINE"
    , ByteString
"LINEAR"
    , Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
ftHybridLinearCount
    ]
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> ((Double, Double) -> [ByteString])
-> Maybe (Double, Double)
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(Double
alpha, Double
beta) -> [ByteString
"ALPHA", Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
alpha, ByteString
"BETA", Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
beta]) Maybe (Double, Double)
ftHybridLinearAlphaBeta
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
window -> [ByteString
"WINDOW", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
window]) Maybe Integer
ftHybridLinearWindow
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
name -> [ByteString
"YIELD_SCORE_AS", ByteString
name]) Maybe ByteString
ftHybridLinearYieldScoreAs

hybridSortToArgs :: FTHybridSort -> [ByteString]
hybridSortToArgs :: FTHybridSort -> [ByteString]
hybridSortToArgs FTHybridSort
FTHybridNoSort = [ByteString
"NOSORT"]
hybridSortToArgs (FTHybridSortBy ByteString
field Maybe SortOrder
order) =
    [ByteString
"SORTBY", ByteString
field] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (SortOrder -> [ByteString]) -> Maybe SortOrder -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\SortOrder
sortOrder -> [SortOrder -> ByteString
forall {a}. IsString a => SortOrder -> a
encodeSortOrder SortOrder
sortOrder]) Maybe SortOrder
order
  where
    encodeSortOrder :: SortOrder -> a
encodeSortOrder SortOrder
Asc = a
"ASC"
    encodeSortOrder SortOrder
Desc = a
"DESC"

hybridLoadToArgs :: FTHybridLoad -> [ByteString]
hybridLoadToArgs :: FTHybridLoad -> [ByteString]
hybridLoadToArgs FTHybridLoad
FTHybridLoadAll = [ByteString
"LOAD", ByteString
"*"]
hybridLoadToArgs (FTHybridLoadFields NonEmpty ByteString
fields) =
    [ByteString
"LOAD", [ByteString] -> ByteString
forall a. [a] -> ByteString
countArgs (NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
fields)] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
fields

ftHybridOptsToArgs :: FTHybridOpts -> [ByteString]
ftHybridOptsToArgs :: FTHybridOpts -> [ByteString]
ftHybridOptsToArgs FTHybridOpts{[(ByteString, ByteString)]
[FTApply]
[FTGroupBy]
Maybe Integer
Maybe (Integer, Integer)
Maybe ByteString
Maybe FTHybridLoad
Maybe FTHybridSort
Maybe FTHybridCombine
ftHybridCombine :: FTHybridOpts -> Maybe FTHybridCombine
ftHybridLimit :: FTHybridOpts -> Maybe (Integer, Integer)
ftHybridSorting :: FTHybridOpts -> Maybe FTHybridSort
ftHybridParams :: FTHybridOpts -> [(ByteString, ByteString)]
ftHybridTimeout :: FTHybridOpts -> Maybe Integer
ftHybridFormat :: FTHybridOpts -> Maybe ByteString
ftHybridLoad :: FTHybridOpts -> Maybe FTHybridLoad
ftHybridGroupBy :: FTHybridOpts -> [FTGroupBy]
ftHybridApply :: FTHybridOpts -> [FTApply]
ftHybridFilter :: FTHybridOpts -> Maybe ByteString
ftHybridDialect :: FTHybridOpts -> Maybe Integer
ftHybridCombine :: Maybe FTHybridCombine
ftHybridLimit :: Maybe (Integer, Integer)
ftHybridSorting :: Maybe FTHybridSort
ftHybridParams :: [(ByteString, ByteString)]
ftHybridTimeout :: Maybe Integer
ftHybridFormat :: Maybe ByteString
ftHybridLoad :: Maybe FTHybridLoad
ftHybridGroupBy :: [FTGroupBy]
ftHybridApply :: [FTApply]
ftHybridFilter :: Maybe ByteString
ftHybridDialect :: Maybe Integer
..} =
    [ByteString]
-> (FTHybridCombine -> [ByteString])
-> Maybe FTHybridCombine
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTHybridCombine -> [ByteString]
hybridCombineToArgs Maybe FTHybridCombine
ftHybridCombine
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
limitArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (FTHybridSort -> [ByteString])
-> Maybe FTHybridSort
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTHybridSort -> [ByteString]
hybridSortToArgs Maybe FTHybridSort
ftHybridSorting
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
paramsArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
timeoutArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
formatArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (FTHybridLoad -> [ByteString])
-> Maybe FTHybridLoad
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTHybridLoad -> [ByteString]
hybridLoadToArgs Maybe FTHybridLoad
ftHybridLoad
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTGroupBy -> [ByteString]) -> [FTGroupBy] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTGroupBy -> [ByteString]
groupByToArgs [FTGroupBy]
ftHybridGroupBy
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTApply -> [ByteString]) -> [FTApply] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTApply -> [ByteString]
applyToArgs [FTApply]
ftHybridApply
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
filterArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
dialectArg
  where
    limitArg :: [ByteString]
limitArg = [ByteString]
-> ((Integer, Integer) -> [ByteString])
-> Maybe (Integer, Integer)
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\(Integer
offset, Integer
num) -> [ByteString
"LIMIT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
offset, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
num]) Maybe (Integer, Integer)
ftHybridLimit
    paramsArg :: [ByteString]
paramsArg =
        if [(ByteString, ByteString)] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [(ByteString, ByteString)]
ftHybridParams
            then []
            else [ByteString
"PARAMS", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode (Int -> Integer
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
2 Int -> Int -> Int
forall a. Num a => a -> a -> a
* [(ByteString, ByteString)] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [(ByteString, ByteString)]
ftHybridParams) :: Integer)]
                [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ ((ByteString, ByteString) -> [ByteString])
-> [(ByteString, ByteString)] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\(ByteString
name, ByteString
value) -> [ByteString
name, ByteString
value]) [(ByteString, ByteString)]
ftHybridParams
    timeoutArg :: [ByteString]
timeoutArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
timeout -> [ByteString
"TIMEOUT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
timeout]) Maybe Integer
ftHybridTimeout
    formatArg :: [ByteString]
formatArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
format -> [ByteString
"FORMAT", ByteString
format]) Maybe ByteString
ftHybridFormat
    filterArg :: [ByteString]
filterArg = [ByteString]
-> (ByteString -> [ByteString]) -> Maybe ByteString -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\ByteString
expr -> [ByteString
"FILTER", ByteString
expr]) Maybe ByteString
ftHybridFilter
    dialectArg :: [ByteString]
dialectArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
dialect -> [ByteString
"DIALECT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
dialect]) Maybe Integer
ftHybridDialect

ftProfileOptsToArgs :: FTProfileOpts -> [ByteString]
ftProfileOptsToArgs :: FTProfileOpts -> [ByteString]
ftProfileOptsToArgs FTProfileOpts{Bool
ftProfileLimited :: FTProfileOpts -> Bool
ftProfileLimited :: Bool
..} =
    [ByteString
"LIMITED" | Bool
ftProfileLimited]

spellcheckTermsModeToArgs :: FTSpellcheckTermsMode -> [ByteString]
spellcheckTermsModeToArgs :: FTSpellcheckTermsMode -> [ByteString]
spellcheckTermsModeToArgs FTSpellcheckTermsMode
termsMode =
    case FTSpellcheckTermsMode
termsMode of
        FTSpellcheckInclude ByteString
dictionary [ByteString]
terms ->
            [ByteString
"TERMS", ByteString
"INCLUDE", ByteString
dictionary] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
terms
        FTSpellcheckExclude ByteString
dictionary [ByteString]
terms ->
            [ByteString
"TERMS", ByteString
"EXCLUDE", ByteString
dictionary] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
terms

ftSpellcheckOptsToArgs :: FTSpellcheckOpts -> [ByteString]
ftSpellcheckOptsToArgs :: FTSpellcheckOpts -> [ByteString]
ftSpellcheckOptsToArgs FTSpellcheckOpts{Maybe Integer
Maybe FTSpellcheckTermsMode
ftSpellcheckDistance :: FTSpellcheckOpts -> Maybe Integer
ftSpellcheckTermsMode :: FTSpellcheckOpts -> Maybe FTSpellcheckTermsMode
ftSpellcheckDialect :: FTSpellcheckOpts -> Maybe Integer
ftSpellcheckDistance :: Maybe Integer
ftSpellcheckTermsMode :: Maybe FTSpellcheckTermsMode
ftSpellcheckDialect :: Maybe Integer
..} =
    [ByteString]
distanceArg
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
-> (FTSpellcheckTermsMode -> [ByteString])
-> Maybe FTSpellcheckTermsMode
-> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] FTSpellcheckTermsMode -> [ByteString]
spellcheckTermsModeToArgs Maybe FTSpellcheckTermsMode
ftSpellcheckTermsMode
        [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString]
dialectArg
  where
    distanceArg :: [ByteString]
distanceArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
distance -> [ByteString
"DISTANCE", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
distance]) Maybe Integer
ftSpellcheckDistance
    dialectArg :: [ByteString]
dialectArg = [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
dialect -> [ByteString
"DIALECT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
dialect]) Maybe Integer
ftSpellcheckDialect

ftSugAddOptsToArgs :: FTSugAddOpts -> [ByteString]
ftSugAddOptsToArgs :: FTSugAddOpts -> [ByteString]
ftSugAddOptsToArgs FTSugAddOpts
FTSugAddDefault = []
ftSugAddOptsToArgs (FTSugAddWithPayload ByteString
payload) = [ByteString
"PAYLOAD", ByteString
payload]
ftSugAddOptsToArgs FTSugAddOpts
FTSugAddIncrement = [ByteString
"INCR"]
ftSugAddOptsToArgs (FTSugAddIncrementWithPayload ByteString
payload) = [ByteString
"INCR", ByteString
"PAYLOAD", ByteString
payload]

ftCursorReadOptsToArgs :: FTCursorReadOpts -> [ByteString]
ftCursorReadOptsToArgs :: FTCursorReadOpts -> [ByteString]
ftCursorReadOptsToArgs FTCursorReadOpts{Maybe Integer
ftCursorReadCount :: FTCursorReadOpts -> Maybe Integer
ftCursorReadCount :: Maybe Integer
..} =
    [ByteString]
-> (Integer -> [ByteString]) -> Maybe Integer -> [ByteString]
forall b a. b -> (a -> b) -> Maybe a -> b
maybe [] (\Integer
count -> [ByteString
"COUNT", Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
count]) Maybe Integer
ftCursorReadCount

-- |Returns a list of all existing indexes (<https://redis.io/commands/ft._list>).
--
-- /O(1)/
--
-- Since RediSearch 2.0.0
ftList
    :: (RedisCtx m f)
    => m (f [ByteString])
ftList :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
m (f [ByteString])
ftList = [ByteString] -> m (f [ByteString])
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT._LIST"]

-- |Run a search query on an index and perform aggregate transformations on the results (<https://redis.io/commands/ft.aggregate>).
--
-- The reply shape varies with options such as @WITHCURSOR@, so this wrapper returns the raw 'Reply'.
--
-- /O(1)/
--
-- Since RediSearch 1.1.0
ftAggregate
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Query string.
    -> m (f Reply)
ftAggregate :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
ftAggregate ByteString
index ByteString
query = ByteString -> ByteString -> FTAggregateOpts -> m (f Reply)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> FTAggregateOpts -> m (f Reply)
ftAggregateOpts ByteString
index ByteString
query FTAggregateOpts
defaultFTAggregateOpts

-- |Run a search query on an index and perform aggregate transformations on the results (<https://redis.io/commands/ft.aggregate>).
--
-- The reply shape varies with options such as @WITHCURSOR@, so this wrapper returns the raw 'Reply'.
--
-- /O(1)/
--
-- Since RediSearch 1.1.0
ftAggregateOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Query string.
    -> FTAggregateOpts -- ^ Aggregate options and transformation steps.
    -> m (f Reply)
ftAggregateOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> FTAggregateOpts -> m (f Reply)
ftAggregateOpts ByteString
index ByteString
query FTAggregateOpts
opts =
    [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.AGGREGATE", ByteString
index, ByteString
query] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTAggregateOpts -> [ByteString]
ftAggregateOptsToArgs FTAggregateOpts
opts

-- |Adds an alias to the index (<https://redis.io/commands/ft.aliasadd>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftAliasAdd
    :: (RedisCtx m f)
    => ByteString -- ^ Alias name.
    -> ByteString -- ^ Index name.
    -> m (f Status)
ftAliasAdd :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Status)
ftAliasAdd ByteString
alias ByteString
index = [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.ALIASADD", ByteString
alias, ByteString
index]

-- |Deletes an alias from the index (<https://redis.io/commands/ft.aliasdel>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftAliasDel
    :: (RedisCtx m f)
    => ByteString -- ^ Alias name.
    -> m (f Status)
ftAliasDel :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Status)
ftAliasDel ByteString
alias = [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.ALIASDEL", ByteString
alias]

-- |Adds or updates an alias to the index (<https://redis.io/commands/ft.aliasupdate>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftAliasUpdate
    :: (RedisCtx m f)
    => ByteString -- ^ Alias name.
    -> ByteString -- ^ Index name.
    -> m (f Status)
ftAliasUpdate :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Status)
ftAliasUpdate ByteString
alias ByteString
index = [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.ALIASUPDATE", ByteString
alias, ByteString
index]

-- |Adds a new field to the index (<https://redis.io/commands/ft.alter>).
--
-- /O(N)/ where /N/ is the number of keys in the keyspace
--
-- Since RediSearch 1.0.0
ftAlter
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> FTCreateField -- ^ Field definition to append to the schema.
    -> m (f Status)
ftAlter :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> FTCreateField -> m (f Status)
ftAlter ByteString
index FTCreateField
field = ByteString -> FTCreateField -> FTAlterOpts -> m (f Status)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> FTCreateField -> FTAlterOpts -> m (f Status)
ftAlterOpts ByteString
index FTCreateField
field FTAlterOpts
defaultFTAlterOpts

-- |Adds a new field to the index (<https://redis.io/commands/ft.alter>).
--
-- /O(N)/ where /N/ is the number of keys in the keyspace
--
-- Since RediSearch 1.0.0
ftAlterOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> FTCreateField -- ^ Field definition to append to the schema.
    -> FTAlterOpts -- ^ Alter options.
    -> m (f Status)
ftAlterOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> FTCreateField -> FTAlterOpts -> m (f Status)
ftAlterOpts ByteString
index FTCreateField
field FTAlterOpts
opts =
    [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Status)) -> [ByteString] -> m (f Status)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.ALTER", ByteString
index] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTAlterOpts -> [ByteString]
ftAlterOptsToArgs FTAlterOpts
opts [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"SCHEMA", ByteString
"ADD"] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCreateField -> [ByteString]
createFieldToArgs FTCreateField
field

-- |Sets runtime configuration options (<https://redis.io/commands/ft.config-set>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftConfigSet
    :: (RedisCtx m f)
    => ByteString -- ^ Option name.
    -> ByteString -- ^ Option value.
    -> m (f Status)
ftConfigSet :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Status)
ftConfigSet ByteString
option ByteString
value = [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.CONFIG", ByteString
"SET", ByteString
option, ByteString
value]

-- |Retrieves runtime configuration options (<https://redis.io/commands/ft.config-get>).
--
-- The server returns an option-dependent reply payload, so this wrapper returns the raw 'Reply'.
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftConfigGet
    :: (RedisCtx m f)
    => ByteString -- ^ Option name or pattern.
    -> m (f Reply)
ftConfigGet :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
ftConfigGet ByteString
option = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.CONFIG", ByteString
"GET", ByteString
option]

-- |Creates an index with the given spec (<https://redis.io/commands/ft.create>).
--
-- /O(K)/ at creation where /K/ is the number of fields, /O(N)/ if scanning the keyspace is triggered, where /N/ is the number of keys in the keyspace
--
-- Since RediSearch 1.0.0
ftCreate
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> NonEmpty FTCreateField -- ^ Schema field definitions.
    -> m (f Status)
ftCreate :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> NonEmpty FTCreateField -> m (f Status)
ftCreate ByteString
index NonEmpty FTCreateField
fields = ByteString
-> NonEmpty FTCreateField -> FTCreateOpts -> m (f Status)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> NonEmpty FTCreateField -> FTCreateOpts -> m (f Status)
ftCreateOpts ByteString
index NonEmpty FTCreateField
fields FTCreateOpts
defaultFTCreateOpts

-- |Creates an index with the given spec (<https://redis.io/commands/ft.create>).
--
-- /O(K)/ at creation where /K/ is the number of fields, /O(N)/ if scanning the keyspace is triggered, where /N/ is the number of keys in the keyspace
--
-- Since RediSearch 1.0.0
ftCreateOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> NonEmpty FTCreateField -- ^ Schema field definitions.
    -> FTCreateOpts -- ^ Index creation options.
    -> m (f Status)
ftCreateOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> NonEmpty FTCreateField -> FTCreateOpts -> m (f Status)
ftCreateOpts ByteString
index NonEmpty FTCreateField
fields FTCreateOpts
opts =
    [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Status)) -> [ByteString] -> m (f Status)
forall a b. (a -> b) -> a -> b
$
        [ByteString
"FT.CREATE", ByteString
index]
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCreateOpts -> [ByteString]
ftCreateOptsToArgs FTCreateOpts
opts
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"SCHEMA"]
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ (FTCreateField -> [ByteString]) -> [FTCreateField] -> [ByteString]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap FTCreateField -> [ByteString]
createFieldToArgs (NonEmpty FTCreateField -> [FTCreateField]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty FTCreateField
fields)

-- |Deletes a cursor (<https://redis.io/commands/ft.cursor-del>).
--
-- /O(1)/
--
-- Since RediSearch 1.1.0
ftCursorDel
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> Integer -- ^ Cursor identifier.
    -> m (f Status)
ftCursorDel :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> Integer -> m (f Status)
ftCursorDel ByteString
index Integer
cursorId = [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.CURSOR", ByteString
"DEL", ByteString
index, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
cursorId]

-- |Reads from a cursor (<https://redis.io/commands/ft.cursor-read>).
--
-- The cursor batch payload is command-dependent, so this wrapper returns the raw 'Reply'.
--
-- /O(1)/
--
-- Since RediSearch 1.1.0
ftCursorRead
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> Integer -- ^ Cursor identifier.
    -> m (f Reply)
ftCursorRead :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> Integer -> m (f Reply)
ftCursorRead ByteString
index Integer
cursorId = ByteString -> Integer -> FTCursorReadOpts -> m (f Reply)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> Integer -> FTCursorReadOpts -> m (f Reply)
ftCursorReadOpts ByteString
index Integer
cursorId FTCursorReadOpts
defaultFTCursorReadOpts

-- |Reads from a cursor (<https://redis.io/commands/ft.cursor-read>).
--
-- The cursor batch payload is command-dependent, so this wrapper returns the raw 'Reply'.
--
-- /O(1)/
--
-- Since RediSearch 1.1.0
ftCursorReadOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> Integer -- ^ Cursor identifier.
    -> FTCursorReadOpts -- ^ Cursor read options.
    -> m (f Reply)
ftCursorReadOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> Integer -> FTCursorReadOpts -> m (f Reply)
ftCursorReadOpts ByteString
index Integer
cursorId FTCursorReadOpts
opts =
    [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.CURSOR", ByteString
"READ", ByteString
index, Integer -> ByteString
forall a. RedisArg a => a -> ByteString
encode Integer
cursorId] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTCursorReadOpts -> [ByteString]
ftCursorReadOptsToArgs FTCursorReadOpts
opts

-- |Adds terms to a dictionary (<https://redis.io/commands/ft.dictadd>).
--
-- /O(1)/
--
-- Since RediSearch 1.4.0
ftDictAdd
    :: (RedisCtx m f)
    => ByteString -- ^ Dictionary name.
    -> NonEmpty ByteString -- ^ Terms to add.
    -> m (f Integer)
ftDictAdd :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> NonEmpty ByteString -> m (f Integer)
ftDictAdd ByteString
dict NonEmpty ByteString
terms = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Integer)) -> [ByteString] -> m (f Integer)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.DICTADD", ByteString
dict] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
terms

-- |Deletes terms from a dictionary (<https://redis.io/commands/ft.dictdel>).
--
-- /O(1)/
--
-- Since RediSearch 1.4.0
ftDictDel
    :: (RedisCtx m f)
    => ByteString -- ^ Dictionary name.
    -> NonEmpty ByteString -- ^ Terms to delete.
    -> m (f Integer)
ftDictDel :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> NonEmpty ByteString -> m (f Integer)
ftDictDel ByteString
dict NonEmpty ByteString
terms = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Integer)) -> [ByteString] -> m (f Integer)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.DICTDEL", ByteString
dict] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ NonEmpty ByteString -> [ByteString]
forall a. NonEmpty a -> [a]
NE.toList NonEmpty ByteString
terms

-- |Deletes the index (<https://redis.io/commands/ft.dropindex>).
--
-- /O(1)/ or /O(N)/ if documents are deleted, where /N/ is the number of keys in the keyspace
--
-- Since RediSearch 2.0.0
ftDropIndex
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> m (f Status)
ftDropIndex :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Status)
ftDropIndex ByteString
index = [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.DROPINDEX", ByteString
index]

-- |Deletes the index (<https://redis.io/commands/ft.dropindex>).
--
-- This variant also deletes indexed documents.
--
-- /O(1)/ or /O(N)/ if documents are deleted, where /N/ is the number of keys in the keyspace
--
-- Since RediSearch 2.0.0
ftDropIndexDeleteDocs
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> m (f Status)
ftDropIndexDeleteDocs :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Status)
ftDropIndexDeleteDocs ByteString
index = [ByteString] -> m (f Status)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.DROPINDEX", ByteString
index, ByteString
"DD"]

-- |Returns the execution plan for a complex query (<https://redis.io/commands/ft.explain>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftExplain
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Query string.
    -> m (f ByteString)
ftExplain :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f ByteString)
ftExplain ByteString
index ByteString
query = ByteString -> ByteString -> FTExplainOpts -> m (f ByteString)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> FTExplainOpts -> m (f ByteString)
ftExplainOpts ByteString
index ByteString
query FTExplainOpts
defaultFTExplainOpts

-- |Returns the execution plan for a complex query (<https://redis.io/commands/ft.explain>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftExplainOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Query string.
    -> FTExplainOpts -- ^ Explain options.
    -> m (f ByteString)
ftExplainOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> FTExplainOpts -> m (f ByteString)
ftExplainOpts ByteString
index ByteString
query FTExplainOpts
opts =
    [ByteString] -> m (f ByteString)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f ByteString))
-> [ByteString] -> m (f ByteString)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.EXPLAIN", ByteString
index, ByteString
query] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTExplainOpts -> [ByteString]
ftExplainOptsToArgs FTExplainOpts
opts

-- |Performs hybrid search combining text search and vector similarity with configurable fusion methods (<https://redis.io/commands/ft.hybrid>).
--
-- The reply shape depends on requested projections and scoring options, so this wrapper returns the raw 'Reply'.
--
-- /O(N)/
--
-- Since Redis Open Source 8.4.0
ftHybrid
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> FTHybridSearchClause -- ^ Textual search clause.
    -> FTHybridVSimClause -- ^ Vector similarity clause.
    -> m (f Reply)
ftHybrid :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> FTHybridSearchClause -> FTHybridVSimClause -> m (f Reply)
ftHybrid ByteString
index FTHybridSearchClause
searchClause FTHybridVSimClause
vsimClause =
    ByteString
-> FTHybridSearchClause
-> FTHybridVSimClause
-> FTHybridOpts
-> m (f Reply)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> FTHybridSearchClause
-> FTHybridVSimClause
-> FTHybridOpts
-> m (f Reply)
ftHybridOpts ByteString
index FTHybridSearchClause
searchClause FTHybridVSimClause
vsimClause FTHybridOpts
defaultFTHybridOpts

-- |Performs hybrid search combining text search and vector similarity with configurable fusion methods (<https://redis.io/commands/ft.hybrid>).
--
-- The reply shape depends on requested projections and scoring options, so this wrapper returns the raw 'Reply'.
--
-- /O(N)/
--
-- Since Redis Open Source 8.4.0
ftHybridOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> FTHybridSearchClause -- ^ Textual search clause.
    -> FTHybridVSimClause -- ^ Vector similarity clause.
    -> FTHybridOpts -- ^ Hybrid query options.
    -> m (f Reply)
ftHybridOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> FTHybridSearchClause
-> FTHybridVSimClause
-> FTHybridOpts
-> m (f Reply)
ftHybridOpts ByteString
index FTHybridSearchClause
searchClause FTHybridVSimClause
vsimClause FTHybridOpts
opts =
    [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$
        [ByteString
"FT.HYBRID", ByteString
index]
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTHybridSearchClause -> [ByteString]
hybridSearchClauseToArgs FTHybridSearchClause
searchClause
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTHybridVSimClause -> [ByteString]
hybridVSimClauseToArgs FTHybridVSimClause
vsimClause
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTHybridOpts -> [ByteString]
ftHybridOptsToArgs FTHybridOpts
opts

-- |Returns information and statistics on the index (<https://redis.io/commands/ft.info>).
--
-- The response is a heterogeneous attribute map, so this wrapper returns the raw 'Reply'.
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftInfo
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> m (f Reply)
ftInfo :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Reply)
ftInfo ByteString
index = [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.INFO", ByteString
index]

-- |Performs a `FT.SEARCH` or `FT.AGGREGATE` command and collects performance information (<https://redis.io/commands/ft.profile>).
--
-- The profiled reply depends on the wrapped query type, so this wrapper returns the raw 'Reply'.
--
-- /O(N)/
--
-- Since RediSearch 2.2.0
ftProfile
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> FTProfileQueryType -- ^ Wrapped query type.
    -> ByteString -- ^ Query payload for the wrapped command.
    -> m (f Reply)
ftProfile :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> FTProfileQueryType -> ByteString -> m (f Reply)
ftProfile ByteString
index FTProfileQueryType
queryType ByteString
query =
    ByteString
-> FTProfileQueryType -> ByteString -> FTProfileOpts -> m (f Reply)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> FTProfileQueryType -> ByteString -> FTProfileOpts -> m (f Reply)
ftProfileOpts ByteString
index FTProfileQueryType
queryType ByteString
query FTProfileOpts
defaultFTProfileOpts

-- |Performs a `FT.SEARCH` or `FT.AGGREGATE` command and collects performance information (<https://redis.io/commands/ft.profile>).
--
-- The profiled reply depends on the wrapped query type, so this wrapper returns the raw 'Reply'.
--
-- /O(N)/
--
-- Since RediSearch 2.2.0
ftProfileOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> FTProfileQueryType -- ^ Wrapped query type.
    -> ByteString -- ^ Query payload for the wrapped command.
    -> FTProfileOpts -- ^ Profiling options.
    -> m (f Reply)
ftProfileOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString
-> FTProfileQueryType -> ByteString -> FTProfileOpts -> m (f Reply)
ftProfileOpts ByteString
index FTProfileQueryType
queryType ByteString
query FTProfileOpts
opts =
    [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$
        [ByteString
"FT.PROFILE", ByteString
index, FTProfileQueryType -> ByteString
forall a. RedisArg a => a -> ByteString
encode FTProfileQueryType
queryType]
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTProfileOpts -> [ByteString]
ftProfileOptsToArgs FTProfileOpts
opts
            [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ [ByteString
"QUERY", ByteString
query]

-- |Searches the index with a textual query, returning either documents or just ids (<https://redis.io/commands/ft.search>).
--
-- The reply shape depends on output flags such as @NOCONTENT@ and @WITHSCORES@, so this wrapper returns the raw 'Reply'.
--
-- /O(N)/
--
-- Since RediSearch 1.0.0
ftSearch
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Query string.
    -> m (f Reply)
ftSearch :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
ftSearch ByteString
index ByteString
query = ByteString -> ByteString -> FTSearchOpts -> m (f Reply)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> FTSearchOpts -> m (f Reply)
ftSearchOpts ByteString
index ByteString
query FTSearchOpts
defaultFTSearchOpts

-- |Searches the index with a textual query, returning either documents or just ids (<https://redis.io/commands/ft.search>).
--
-- The reply shape depends on output flags such as @NOCONTENT@ and @WITHSCORES@, so this wrapper returns the raw 'Reply'.
--
-- /O(N)/
--
-- Since RediSearch 1.0.0
ftSearchOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Query string.
    -> FTSearchOpts -- ^ Search options.
    -> m (f Reply)
ftSearchOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> FTSearchOpts -> m (f Reply)
ftSearchOpts ByteString
index ByteString
query FTSearchOpts
opts =
    [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.SEARCH", ByteString
index, ByteString
query] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTSearchOpts -> [ByteString]
ftSearchOptsToArgs FTSearchOpts
opts

-- |Performs spelling correction on a query, returning suggestions for misspelled terms (<https://redis.io/commands/ft.spellcheck>).
--
-- The response contains nested suggestions, so this wrapper returns the raw 'Reply'.
--
-- /O(1)/
--
-- Since RediSearch 1.4.0
ftSpellcheck
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Query string.
    -> m (f Reply)
ftSpellcheck :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Reply)
ftSpellcheck ByteString
index ByteString
query = ByteString -> ByteString -> FTSpellcheckOpts -> m (f Reply)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> FTSpellcheckOpts -> m (f Reply)
ftSpellcheckOpts ByteString
index ByteString
query FTSpellcheckOpts
defaultFTSpellcheckOpts

-- |Performs spelling correction on a query, returning suggestions for misspelled terms (<https://redis.io/commands/ft.spellcheck>).
--
-- The response contains nested suggestions, so this wrapper returns the raw 'Reply'.
--
-- /O(1)/
--
-- Since RediSearch 1.4.0
ftSpellcheckOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Query string.
    -> FTSpellcheckOpts -- ^ Spellcheck options.
    -> m (f Reply)
ftSpellcheckOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> FTSpellcheckOpts -> m (f Reply)
ftSpellcheckOpts ByteString
index ByteString
query FTSpellcheckOpts
opts =
    [ByteString] -> m (f Reply)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Reply)) -> [ByteString] -> m (f Reply)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.SPELLCHECK", ByteString
index, ByteString
query] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTSpellcheckOpts -> [ByteString]
ftSpellcheckOptsToArgs FTSpellcheckOpts
opts

-- |Adds a suggestion string to an auto-complete suggestion dictionary (<https://redis.io/commands/ft.sugadd>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftSugAdd
    :: (RedisCtx m f)
    => ByteString -- ^ Suggestion dictionary key.
    -> ByteString -- ^ Suggestion string.
    -> Double -- ^ Suggestion score.
    -> m (f Integer)
ftSugAdd :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> Double -> m (f Integer)
ftSugAdd ByteString
key ByteString
string Double
score = ByteString -> ByteString -> Double -> FTSugAddOpts -> m (f Integer)
forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> Double -> FTSugAddOpts -> m (f Integer)
ftSugAddOpts ByteString
key ByteString
string Double
score FTSugAddOpts
FTSugAddDefault

-- |Adds a suggestion string to an auto-complete suggestion dictionary (<https://redis.io/commands/ft.sugadd>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftSugAddOpts
    :: (RedisCtx m f)
    => ByteString -- ^ Suggestion dictionary key.
    -> ByteString -- ^ Suggestion string.
    -> Double -- ^ Suggestion score.
    -> FTSugAddOpts -- ^ Suggestion insertion options.
    -> m (f Integer)
ftSugAddOpts :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> Double -> FTSugAddOpts -> m (f Integer)
ftSugAddOpts ByteString
key ByteString
string Double
score FTSugAddOpts
opts =
    [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest ([ByteString] -> m (f Integer)) -> [ByteString] -> m (f Integer)
forall a b. (a -> b) -> a -> b
$ [ByteString
"FT.SUGADD", ByteString
key, ByteString
string, Double -> ByteString
forall a. RedisArg a => a -> ByteString
encode Double
score] [ByteString] -> [ByteString] -> [ByteString]
forall a. [a] -> [a] -> [a]
++ FTSugAddOpts -> [ByteString]
ftSugAddOptsToArgs FTSugAddOpts
opts

-- |Deletes a string from a suggestion index (<https://redis.io/commands/ft.sugdel>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftSugDel
    :: (RedisCtx m f)
    => ByteString -- ^ Suggestion dictionary key.
    -> ByteString -- ^ Suggestion string.
    -> m (f Integer)
ftSugDel :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f Integer)
ftSugDel ByteString
key ByteString
string = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.SUGDEL", ByteString
key, ByteString
string]

-- |Gets the size of an auto-complete suggestion dictionary (<https://redis.io/commands/ft.suglen>).
--
-- /O(1)/
--
-- Since RediSearch 1.0.0
ftSugLen
    :: (RedisCtx m f)
    => ByteString -- ^ Suggestion dictionary key.
    -> m (f Integer)
ftSugLen :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> m (f Integer)
ftSugLen ByteString
key = [ByteString] -> m (f Integer)
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.SUGLEN", ByteString
key]

-- |Returns the distinct tags indexed in a Tag field (<https://redis.io/commands/ft.tagvals>).
--
-- /O(n)/ where /n/ is the number of distinct tags in the field
--
-- Since RediSearch 1.0.0
ftTagVals
    :: (RedisCtx m f)
    => ByteString -- ^ Index name.
    -> ByteString -- ^ Tag field name.
    -> m (f [ByteString])
ftTagVals :: forall (m :: * -> *) (f :: * -> *).
RedisCtx m f =>
ByteString -> ByteString -> m (f [ByteString])
ftTagVals ByteString
index ByteString
field = [ByteString] -> m (f [ByteString])
forall (m :: * -> *) (f :: * -> *) a.
(RedisCtx m f, RedisResult a) =>
[ByteString] -> m (f a)
sendRequest [ByteString
"FT.TAGVALS", ByteString
index, ByteString
field]