Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- escapeText :: Text -> Text
- query :: Configuration -> Text -> Text -> IO (Result QueryResult)
- buildExcerpts :: ExcerptConfiguration -> [Text] -> Text -> Text -> IO (Result [Text])
- runQueries :: Configuration -> [Query] -> IO (Result [QueryResult])
- runQueries' :: Configuration -> [Query] -> IO (Result [SingleResult])
- resultsToMatches :: Int -> [QueryResult] -> [Match]
- maybeQueries :: (Text -> IO ()) -> Configuration -> [Query] -> IO (Maybe [QueryResult])
- data Query = Query {
- queryString :: Text
- queryIndexes :: Text
- queryComment :: Text
- simpleQuery :: Text -> Query
- data Configuration = Configuration {
- host :: String
- port :: Int
- encoding :: String
- weights :: [Int]
- offset :: Int
- limit :: Int
- mode :: MatchMode
- ranker :: Rank
- rankExpr :: String
- sort :: Sort
- sortBy :: String
- minId :: Int
- maxId :: Int
- filters :: [Filter]
- groupBy :: String
- groupSort :: String
- groupByFunc :: GroupByFunction
- groupDistinct :: String
- maxMatches :: Int
- cutoff :: Int
- retryCount :: Int
- retryDelay :: Int
- indexWeights :: [(String, Int)]
- maxQueryTime :: Int
- fieldWeights :: [(String, Int)]
- selectClause :: String
- defaultConfig :: Configuration
Documentation
escapeText :: Text -> Text Source #
Escape all possible meta characters. Most of these characters only need to be escaped in certain contexts however, in normal searching they will all be ignored
:: Configuration | The configuration |
-> Text | The indexes, "*" means every index |
-> Text | The query string |
-> IO (Result QueryResult) | just one search result back |
The query
function runs a single query against the Sphinx daemon.
To pipeline multiple queries in a batch, use and runQueries
.
:: ExcerptConfiguration | Contains host and port for connection and optional configuration for buildExcerpts |
-> [Text] | list of document contents to be highlighted |
-> Text | The indexes, "*" means every index |
-> Text | The query string to use for excerpts |
-> IO (Result [Text]) | the documents with excerpts highlighted |
TODO: add configuration options
runQueries :: Configuration -> [Query] -> IO (Result [QueryResult]) Source #
Make multiple queries at once, using a list of Query
.
For a single query, just use the query method
Easier handling of query result than runQueries'
runQueries' :: Configuration -> [Query] -> IO (Result [SingleResult]) Source #
Lower level- called by runQueries
.
This may be useful for debugging problems- warning messages won't get compressed
resultsToMatches :: Int -> [QueryResult] -> [Match] Source #
Combine results from runQueries
into matches.
maybeQueries :: (Text -> IO ()) -> Configuration -> [Query] -> IO (Maybe [QueryResult]) Source #
executes runQueries
. Log warning and errors, automatically retry.
Return a Nothing on error, otherwise a Just.
Data structure representing one query. It can be sent with runQueries
or runQueries'
to the server in batch mode.
Query | |
|
:: Text | The query string |
-> Query | A query value that can be sent to |
This is a convenience function which accepts a search string and builds a query for that string over all indexes without attaching comments to the queries.
data Configuration Source #
The configuration for a query
A note about encodings: The encoding specified here is used to encode
every Text
value that is sent to the server, and it used to decode all
of the server's answers, including error messages.
If the specified encoding doesn't support characters sent to the server,
they will silently be substituted with the byte value of '\SUB' ::
before transmission.Char
If the server sends a byte value back that the encoding doesn't understand,
the affected bytes will be converted into special values as
specified by that encoding. For example, when decoding invalid UTF-8,
all invalid bytes are going to be substituted with '\65533' ::
.Char
Configuration | |
|
Instances
Show Configuration Source # | |
Defined in Text.Search.Sphinx.Configuration showsPrec :: Int -> Configuration -> ShowS # show :: Configuration -> String # showList :: [Configuration] -> ShowS # |
defaultConfig :: Configuration Source #
A basic, default configuration.