-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Haskell bindings to the Sphinx full-text searching daemon.
--
-- Haskell bindings to the Sphinx full-text searching daemon. Compatible
-- with Sphinx version 2.0
@package sphinx
@version 0.6.0
module Text.Search.Sphinx.ExcerptConfiguration
data ExcerptConfiguration
ExcerptConfiguration :: String -> Int -> String -> String -> String -> String -> Int -> Int -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Int -> Int -> Int -> Bool -> String -> Bool -> String -> ExcerptConfiguration
-- | The hostname of the Sphinx daemon
host :: ExcerptConfiguration -> String
-- | The portnumber of the Sphinx daemon
port :: ExcerptConfiguration -> Int
-- | Encoding used to encode queries to the server, and decode server
-- responses
encoding :: ExcerptConfiguration -> String
beforeMatch :: ExcerptConfiguration -> String
afterMatch :: ExcerptConfiguration -> String
chunkSeparator :: ExcerptConfiguration -> String
limit :: ExcerptConfiguration -> Int
around :: ExcerptConfiguration -> Int
exactPhrase :: ExcerptConfiguration -> Bool
singlePassage :: ExcerptConfiguration -> Bool
useBoundaries :: ExcerptConfiguration -> Bool
weightOrder :: ExcerptConfiguration -> Bool
-- | warning! broken on 1.10-beta (keep to default of false). Fixed on
-- trunk
queryMode :: ExcerptConfiguration -> Bool
forceAllWords :: ExcerptConfiguration -> Bool
limitPassages :: ExcerptConfiguration -> Int
limitWords :: ExcerptConfiguration -> Int
startPassageId :: ExcerptConfiguration -> Int
loadFiles :: ExcerptConfiguration -> Bool
htmlStripMode :: ExcerptConfiguration -> String
allowEmpty :: ExcerptConfiguration -> Bool
passageBoundary :: ExcerptConfiguration -> String
defaultConfig :: ExcerptConfiguration
altConfig :: ExcerptConfiguration
instance Show ExcerptConfiguration
module Text.Search.Sphinx.Types
-- | Data structure representing one query. It can be sent with
-- runQueries or runQueries' to the server in batch
-- mode.
data Query
Query :: Text -> Text -> Text -> Query
-- | The actual query string
queryString :: Query -> Text
-- | The indexes, "*" means every index
queryIndexes :: Query -> Text
-- | A comment string.
queryComment :: Query -> Text
-- | Search commands
data SearchdCommand
ScSearch :: SearchdCommand
ScExcerpt :: SearchdCommand
ScUpdate :: SearchdCommand
ScKeywords :: SearchdCommand
searchdCommand :: SearchdCommand -> Int
-- | Current client-side command implementation versions
data VerCommand
VcSearch :: VerCommand
VcExcerpt :: VerCommand
VcUpdate :: VerCommand
VcKeywords :: VerCommand
-- | Important! 2.0 compatible
verCommand :: Num a => VerCommand -> a
-- | Searchd status codes
data Status
OK :: Status
RETRY :: Status
WARNING :: Status
ERROR :: Int -> Status
-- | status from an individual query
data QueryStatus
QueryOK :: QueryStatus
QueryWARNING :: QueryStatus
QueryERROR :: Int -> QueryStatus
toQueryStatus :: Int -> QueryStatus
toStatus :: Int -> Status
-- | Match modes
data MatchMode
All :: MatchMode
Any :: MatchMode
Phrase :: MatchMode
Boolean :: MatchMode
Extended :: MatchMode
Fullscan :: MatchMode
Extended2 :: MatchMode
-- | Ranking modes (ext2 only)
data Rank
ProximityBm25 :: Rank
Bm25 :: Rank
None :: Rank
WordCount :: Rank
Proximity :: Rank
MatchAny :: Rank
Fieldmask :: Rank
Sph04 :: Rank
Total :: Rank
-- | Sort modes
data Sort
Relevance :: Sort
AttrDesc :: Sort
AttrAsc :: Sort
TimeSegments :: Sort
SortExtended :: Sort
Expr :: Sort
-- | Filter types
data Filter
ExclusionFilter :: Filter -> Filter
FilterValues :: String -> [Int64] -> Filter
FilterRange :: String -> Int64 -> Int64 -> Filter
-- | shortcut for creating an exclusion filter
exclude :: Filter -> Filter
fromEnumFilter :: Num a => Filter -> a
-- | Attribute types
data AttrT
AttrTUInt :: AttrT
AttrTTimestamp :: AttrT
AttrTStr2Ordinal :: AttrT
AttrTBool :: AttrT
AttrTFloat :: AttrT
AttrTBigInt :: AttrT
AttrTString :: AttrT
AttrTWordCount :: AttrT
AttrTMulti :: AttrT -> AttrT
toAttrT :: (Eq a, Num a) => a -> AttrT
attrMultiMask :: Integer
attrT :: Num a => AttrT -> a
-- | Grouping functions
data GroupByFunction
Day :: GroupByFunction
Week :: GroupByFunction
Month :: GroupByFunction
Year :: GroupByFunction
Attr :: GroupByFunction
AttrPair :: GroupByFunction
-- | The result of a query
data QueryResult
QueryResult :: [Match] -> Int -> Int -> [(Text, Int, Int)] -> [ByteString] -> QueryResult
-- | The matches
matches :: QueryResult -> [Match]
-- | Total amount of matches retrieved on server by this query.
total :: QueryResult -> Int
-- | Total amount of matching documents in index.
totalFound :: QueryResult -> Int
-- | processed words with the number of docs and the number of hits.
words :: QueryResult -> [(Text, Int, Int)]
-- | List of attribute names returned in the result. | The Match will
-- contain just the attribute values in the same order.
attributeNames :: QueryResult -> [ByteString]
-- | a single query result, runQueries returns a list of these
data SingleResult
QueryOk :: QueryResult -> SingleResult
QueryWarning :: Text -> QueryResult -> SingleResult
QueryError :: Int -> Text -> SingleResult
-- | a result returned from searchd
data Result a
Ok :: a -> Result a
Warning :: Text -> a -> Result a
Error :: Int -> Text -> Result a
Retry :: Text -> Result a
data Match
Match :: Int64 -> Int -> [Attr] -> Match
documentId :: Match -> Int64
documentWeight :: Match -> Int
attributeValues :: Match -> [Attr]
data Attr
AttrMulti :: [Attr] -> Attr
AttrUInt :: Int -> Attr
AttrBigInt :: Int64 -> Attr
AttrString :: Text -> Attr
AttrFloat :: Float -> Attr
-- | A space-efficient representation of a Word8 vector, supporting many
-- efficient operations. A ByteString contains 8-bit characters
-- only.
--
-- Instances of Eq, Ord, Read, Show, Data, Typeable
data ByteString :: *
instance Show Query
instance Show SearchdCommand
instance Enum SearchdCommand
instance Show VerCommand
instance Show Status
instance Show QueryStatus
instance Show MatchMode
instance Enum MatchMode
instance Show Rank
instance Enum Rank
instance Show Sort
instance Enum Sort
instance Show Filter
instance Show AttrT
instance Show GroupByFunction
instance Enum GroupByFunction
instance Show a => Show (Result a)
instance Show Attr
instance Show Match
instance Show QueryResult
instance Show SingleResult
instance Eq Match
instance Enum AttrT
module Text.Search.Sphinx.Configuration
-- | 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' :: Char before transmission.
--
-- 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.
data Configuration
Configuration :: String -> Int -> String -> [Int] -> Int -> Int -> MatchMode -> Rank -> Sort -> String -> Int -> Int -> [Filter] -> String -> String -> GroupByFunction -> String -> Int -> Int -> Int -> Int -> [(String, Int)] -> Int -> [(String, Int)] -> String -> Configuration
-- | The hostname of the Sphinx daemon
host :: Configuration -> String
-- | The portnumber of the Sphinx daemon
port :: Configuration -> Int
-- | Encoding used to encode queries to the server, and decode server
-- responses
encoding :: Configuration -> String
-- | Per-field weights
weights :: Configuration -> [Int]
-- | How many records to seek from result-set start (default is 0)
offset :: Configuration -> Int
-- | How many records to return from result-set starting at offset (default
-- is 20)
limit :: Configuration -> Int
-- | Query matching mode
mode :: Configuration -> MatchMode
-- | Ranking mode
ranker :: Configuration -> Rank
-- | Match sorting mode
sort :: Configuration -> Sort
-- | Attribute to sort by
sortBy :: Configuration -> String
-- | Minimum ID to match, 0 means no limit
minId :: Configuration -> Int
-- | Maximum ID to match, 0 means no limit
maxId :: Configuration -> Int
-- | attribute filters
filters :: Configuration -> [Filter]
-- | Group-by sorting clause (to sort groups in result set with)
groupBy :: Configuration -> String
-- | Group-by count-distinct attribute
groupSort :: Configuration -> String
-- | Group-by function (to pre-process group-by attribute value with)
groupByFunc :: Configuration -> GroupByFunction
-- | Group-by attribute name
groupDistinct :: Configuration -> String
-- | Maximum number of matches to retrieve
maxMatches :: Configuration -> Int
-- | Cutoff to stop searching at
cutoff :: Configuration -> Int
-- | Distributed retries count
retryCount :: Configuration -> Int
-- | Distributed retries delay
retryDelay :: Configuration -> Int
-- | Per-index weights
indexWeights :: Configuration -> [(String, Int)]
-- | Maximum query time in milliseconds, 0 means no limit
maxQueryTime :: Configuration -> Int
-- | Per-field-name weights
fieldWeights :: Configuration -> [(String, Int)]
-- | attributes to select, defaults to "*"
selectClause :: Configuration -> String
-- | A basic, default configuration.
defaultConfig :: Configuration
instance Show Configuration
module Text.Search.Sphinx.Indexable
data SchemaType
TField :: SchemaType
TAttribute :: AttrT -> SchemaType
TFieldString :: SchemaType
type Id = Int
class SphinxSchema a
toDocument :: SphinxSchema a => a -> (Id, [(String, Attr)])
schema :: SphinxSchema a => a -> [(String, SchemaType)]
serialize :: SphinxSchema a => [a] -> Element
module Text.Search.Sphinx
-- | 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
escapeText :: Text -> Text
-- | The query function runs a single query against the Sphinx
-- daemon. To pipeline multiple queries in a batch, use and
-- runQueries.
query :: Configuration -> Text -> Text -> IO (Result QueryResult)
-- | TODO: add configuration options
buildExcerpts :: ExcerptConfiguration -> [Text] -> Text -> Text -> IO (Result [Text])
-- | 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 [QueryResult])
-- | Lower level- called by runQueries. This may be useful for
-- debugging problems- warning messages won't get compressed
runQueries' :: Configuration -> [Query] -> IO (Result [SingleResult])
-- | Combine results from runQueries into matches.
resultsToMatches :: Int -> [QueryResult] -> [Match]
-- | executes runQueries. Log warning and errors, automatically
-- retry. Return a Nothing on error, otherwise a Just.
maybeQueries :: (Text -> IO ()) -> Configuration -> [Query] -> IO (Maybe [QueryResult])
-- | Data structure representing one query. It can be sent with
-- runQueries or runQueries' to the server in batch
-- mode.
data Query
Query :: Text -> Text -> Text -> Query
-- | The actual query string
queryString :: Query -> Text
-- | The indexes, "*" means every index
queryIndexes :: Query -> Text
-- | A comment string.
queryComment :: Query -> Text
-- | 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.
simpleQuery :: Text -> Query
-- | 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' :: Char before transmission.
--
-- 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.
data Configuration
Configuration :: String -> Int -> String -> [Int] -> Int -> Int -> MatchMode -> Rank -> Sort -> String -> Int -> Int -> [Filter] -> String -> String -> GroupByFunction -> String -> Int -> Int -> Int -> Int -> [(String, Int)] -> Int -> [(String, Int)] -> String -> Configuration
-- | The hostname of the Sphinx daemon
host :: Configuration -> String
-- | The portnumber of the Sphinx daemon
port :: Configuration -> Int
-- | Encoding used to encode queries to the server, and decode server
-- responses
encoding :: Configuration -> String
-- | Per-field weights
weights :: Configuration -> [Int]
-- | How many records to seek from result-set start (default is 0)
offset :: Configuration -> Int
-- | How many records to return from result-set starting at offset (default
-- is 20)
limit :: Configuration -> Int
-- | Query matching mode
mode :: Configuration -> MatchMode
-- | Ranking mode
ranker :: Configuration -> Rank
-- | Match sorting mode
sort :: Configuration -> Sort
-- | Attribute to sort by
sortBy :: Configuration -> String
-- | Minimum ID to match, 0 means no limit
minId :: Configuration -> Int
-- | Maximum ID to match, 0 means no limit
maxId :: Configuration -> Int
-- | attribute filters
filters :: Configuration -> [Filter]
-- | Group-by sorting clause (to sort groups in result set with)
groupBy :: Configuration -> String
-- | Group-by count-distinct attribute
groupSort :: Configuration -> String
-- | Group-by function (to pre-process group-by attribute value with)
groupByFunc :: Configuration -> GroupByFunction
-- | Group-by attribute name
groupDistinct :: Configuration -> String
-- | Maximum number of matches to retrieve
maxMatches :: Configuration -> Int
-- | Cutoff to stop searching at
cutoff :: Configuration -> Int
-- | Distributed retries count
retryCount :: Configuration -> Int
-- | Distributed retries delay
retryDelay :: Configuration -> Int
-- | Per-index weights
indexWeights :: Configuration -> [(String, Int)]
-- | Maximum query time in milliseconds, 0 means no limit
maxQueryTime :: Configuration -> Int
-- | Per-field-name weights
fieldWeights :: Configuration -> [(String, Int)]
-- | attributes to select, defaults to "*"
selectClause :: Configuration -> String
-- | A basic, default configuration.
defaultConfig :: Configuration