packages feed

sphinx 0.3.5 → 0.3.6

raw patch · 3 files changed

+29/−23 lines, 3 filesdep +utf8-string

Dependencies added: utf8-string

Files

Text/Search/Sphinx/ExcerptConfiguration.hs view
@@ -47,7 +47,8 @@   , useBoundaries = False   , startPassageId = 1   , loadFiles = False-  , htmlStripMode = "index" -- ^ "none", "strip", "index", and "retain". +  -- | "none", "strip", "index", and "retain". +  , htmlStripMode = "index"   , allowEmpty = False } 
Text/Search/Sphinx/Indexable.hs view
@@ -1,25 +1,24 @@-module Text.Search.Sphinx.Indexable (Indexable (..), SchemaType (..), AttrType (..), Id, -                                     SphinxSchema (..), serialize)-                                     where+module Text.Search.Sphinx.Indexable (+  SchemaType (..), Id, +  SphinxSchema (..), serialize+  )+  where +import Data.ByteString.Lazy.UTF8 (toString)+import qualified Text.Search.Sphinx.Types as T+ --import Text.Search.Sphinx.Types import Text.XML.Light --- TODO: this should really be the same as Types.Attr-data Indexable = NumAttr Int-               | StrAttr String-               | Field   String- data SchemaType = TField-                | TAttribute AttrType--data AttrType = AString | AInt+                | TAttribute T.AttrT+                | TFieldString  type Id = Int  class SphinxSchema a where   -- | Convert a value of a to a document with a document id and some attributes and fields.-  toDocument :: a -> (Id, [(String, Indexable)])+  toDocument :: a -> (Id, [(String, T.Attr)])   -- | The first parameter should be ignored, but is used to satisfy Haskell's type system.   schema   :: a -> [(String, SchemaType)] @@ -30,16 +29,17 @@     : map (doc . toDocument) items   ) -doc :: (Id, [(String, Indexable)]) -> Element+doc :: (Id, [(String, T.Attr)]) -> Element doc (id, fields) = sphinxEl "document" ! [("id", show id)] <<                      map docEl fields -docEl :: (String, Indexable) -> Element+docEl :: (String, T.Attr) -> Element docEl (name, content) = normalEl name `text` indexableEl content -indexableEl (NumAttr i) = simpleText $ show i-indexableEl (StrAttr f) = simpleText $ f-indexableEl (Field f)   = simpleText $ f+indexableEl (T.AttrUInt i)   = simpleText $ show i+indexableEl (T.AttrString s) = simpleText $ toString s+indexableEl (T.AttrFloat f)  = simpleText $ show f+indexableEl _  = error "not implemented"  simpleText s = CData { cdVerbatim = CDataText                      , cdData     = s@@ -49,10 +49,14 @@ schemaField :: (String, SchemaType) -> Element schemaField (name, TField)       = sphinxEl "field" ! [("name", name)] schemaField (name, TAttribute t) = sphinxEl "attr" ! [("name", name), ("type", attrType t)]+schemaField (name, TFieldString) = sphinxEl "field_string" ! [("name", name), ("type", attrType T.AttrTString)] -attrType :: AttrType -> String-attrType AString = "str2ordinal"-attrType AInt    = "int"+attrType :: T.AttrT -> String+attrType T.AttrTString      = "string"+attrType T.AttrTStr2Ordinal = "str2ordinal"+attrType T.AttrTUInt        = "int"+attrType T.AttrTFloat       = "float"+attrType _       = error "not implemented"  text :: Element -> CData -> Element text el dat = el {elContent = [Text dat]}
sphinx.cabal view
@@ -1,5 +1,5 @@ Name:            sphinx-Version:         0.3.5+Version:         0.3.6 Synopsis:        Haskell bindings to the Sphinx full-text searching deamon. Description:     Haskell bindings to the Sphinx full-text searching deamon. Compatible with sphinx version 1.1 Category:        Text, Search, Database@@ -20,4 +20,5 @@ Build-Type:      Simple Build-Depends:   base >= 4 && < 5,                  binary, data-binary-ieee754,-                 bytestring, network, haskell98, xml+                 bytestring, network, haskell98,+                 xml, utf8-string >= 0.3