module Solr.Query.Param where
import Solr.Prelude
import Builder
import Solr.Query.Filter.Internal
import Solr.Query.Internal
data Param where
ParamFl :: Text -> Param
ParamFq :: Query query => FilterParams query -> query -> Param
ParamQ :: Query query => LocalParams query -> query -> Param
ParamRows :: Int -> Param
ParamSortAsc :: Text -> Param
ParamSortDesc :: Text -> Param
ParamStart :: Int -> Param
fl :: Text -> Param
fl = ParamFl
fq :: Query query => FilterParams query -> query -> Param
fq = ParamFq
q :: Query query => LocalParams query -> query -> Param
q = ParamQ
rows :: Int -> Param
rows = ParamRows
sortAsc :: Text -> Param
sortAsc = ParamSortAsc
sortDesc :: Text -> Param
sortDesc = ParamSortDesc
start :: Int -> Param
start = ParamStart
compileParam :: Param -> Builder
compileParam = \case
ParamFl s -> "fl=" <> thaw' s
ParamFq locals query -> "fq=" <> compileFilterQuery locals query
ParamQ locals query -> "q=" <> compileQuery locals query
ParamRows n -> "rows=" <> bshow n
ParamSortAsc s -> "sort=" <> thaw' s <> " asc"
ParamSortDesc s -> "sort=" <> thaw' s <> " desc"
ParamStart n -> "start=" <> bshow n