sphinx-0.5.3: Haskell bindings to the Sphinx full-text searching daemon.

Safe HaskellSafe-Infered




escapeString :: String -> StringSource

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

-> String

The indexes, * means every index

-> String

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 addQuery and runQueries



:: ExcerptConfiguration

Contains host and port for connection and optional configuration for buildExcerpts

-> [String]

list of document contents to be highlighted

-> String

The indexes, * means every index

-> String

The query string to use for excerpts

-> IO (Result [ByteString])

the documents with excerpts highlighted

TODO: add configuration options

runQueries :: Configuration -> [Put] -> IO (Result [QueryResult])Source

Use with addQuery to pipeline multiple queries. For a single query, just use the query method Easier handling of query result than runQueries'

runQueries' :: Configuration -> [Put] -> 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 :: (ByteString -> IO ()) -> Configuration -> [Put] -> IO (Maybe [QueryResult])Source

executes runQueries. Log warning and errors, automatically retry. Return a Nothing on error, otherwise a Just.

getResponse :: Handle -> IO (Status, ByteString)Source

TODO: hide this function

addQuery :: Configuration -> String -> String -> String -> PutSource

use with runQueries to pipeline a batch of queries

data Configuration Source

The configuration for a query




host :: String

The hostname of the Sphinx daemon

port :: Int

The portnumber of the Sphinx daemon

weights :: [Int]

Per-field weights

offset :: Int

How many records to seek from result-set start (default is 0)

limit :: Int

How many records to return from result-set starting at offset (default is 20)

mode :: MatchMode

Query matching mode

ranker :: Rank

Ranking mode

sort :: Sort

Match sorting mode

sortBy :: String

Attribute to sort by

minId :: Int

Minimum ID to match, 0 means no limit

maxId :: Int

Maximum ID to match, 0 means no limit

filters :: [Filter]

attribute filters

groupBy :: String

Group-by sorting clause (to sort groups in result set with)

groupSort :: String

Group-by count-distinct attribute

groupByFunc :: GroupByFunction

Group-by function (to pre-process group-by attribute value with)

groupDistinct :: String

Group-by attribute name

maxMatches :: Int

Maximum number of matches to retrieve

cutoff :: Int

Cutoff to stop searching at

retryCount :: Int

Distributed retries count

retryDelay :: Int

Distributed retries delay

indexWeights :: [(String, Int)]

Per-index weights

maxQueryTime :: Int

Maximum query time in milliseconds, 0 means no limit

fieldWeights :: [(String, Int)]

Per-field-name weights

selectClause :: String

attributes to select, defaults to *


defaultConfig :: ConfigurationSource

A basic, default configuration.