Skip to content
Browse files

Fix breakBy.

  • Loading branch information...
1 parent 597b8a6 commit afd23f14a90b2bda5dbffe0fc7b4933bc62c1674 @adimit adimit committed Aug 28, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 Text/Search/Sphinx.hs
View
3 Text/Search/Sphinx.hs
@@ -64,7 +64,8 @@ escapedChars = '"':'\\':"-!@~/()*[]="
-- however, in normal searching they will all be ignored
escapeText :: Text -> Text
escapeText = X.intercalate "\\" . breakBy (`elem` escapedChars)
- where breakBy = X.groupBy . const . fmap not
+ where breakBy p t | X.null t = [X.empty]
+ | otherwise = (if p $ X.head t then ("":) else id) $ X.groupBy (\_ x -> not $ p x) t
-- | The 'query' function runs a single query against the Sphinx daemon.
-- To pipeline multiple queries in a batch, use and 'runQueries'.

0 comments on commit afd23f1

Please sign in to comment.
Something went wrong with that request. Please try again.