Permalink
Browse files

Indexes are now also passed as Text.

  • Loading branch information...
adimit committed Aug 29, 2012
1 parent 0804a0b commit 9759640769ab586f5d4541cc059a95db3b82d929
Showing with 5 additions and 5 deletions.
  1. +4 −4 Text/Search/Sphinx.hs
  2. +1 −1 Text/Search/Sphinx/Types.hs
View
@@ -70,7 +70,7 @@ escapeText = X.intercalate "\\" . breakBy (`elem` escapedChars)
-- | The 'query' function runs a single query against the Sphinx daemon.
-- To pipeline multiple queries in a batch, use and 'runQueries'.
query :: Configuration -- ^ The configuration
- -> String -- ^ The indexes, \"*\" means every index
+ -> Text -- ^ The indexes, \"*\" means every index
-> Text -- ^ The query string
-> IO (T.Result T.QueryResult) -- ^ just one search result back
query config indexes search = do
@@ -109,7 +109,7 @@ connect host port = do
-- | TODO: add configuration options
buildExcerpts :: ExConf.ExcerptConfiguration -- ^ Contains host and port for connection and optional configuration for buildExcerpts
-> [Text] -- ^ list of document contents to be highlighted
- -> String -- ^ The indexes, \"*\" means every index
+ -> Text -- ^ The indexes, \"*\" means every index
-> Text -- ^ The query string to use for excerpts
-> IO (T.Result [Text]) -- ^ the documents with excerpts highlighted
buildExcerpts config docs indexes words = do
@@ -138,7 +138,7 @@ buildExcerpts config docs indexes words = do
addExcerpt conv = do
num 0 -- mode
num $ excerptFlags config
- str indexes
+ txt conv indexes
txt conv words
strC config [ExConf.beforeMatch, ExConf.afterMatch, ExConf.chunkSeparator]
numC config [ExConf.limit, ExConf.around, ExConf.limitPassages, ExConf.limitWords, ExConf.startPassageId]
@@ -288,7 +288,7 @@ serializeQuery cfg conv (T.Query qry indexes comment) = do
str (sortBy cfg)
txt conv qry
list num (weights cfg)
- str indexes
+ txt conv indexes
num 1 -- id64 range marker
numC64 cfg [minId, maxId] -- id64 range
@@ -11,7 +11,7 @@ import Data.Text (Text,empty)
-- | Data structure representing one query. It can be sent with 'runQueries'
-- or 'runQueries'' to the server in batch mode.
data Query = Query { queryString :: Text -- ^ The actual query string
- , queryIndexes :: String -- ^ The indexes, \"*\" means every index
+ , queryIndexes :: Text -- ^ The indexes, \"*\" means every index
, queryComment :: Text -- ^ A comment string.
} deriving (Show)

0 comments on commit 9759640

Please sign in to comment.