]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Storage/Types.hs
improvements related to page search
[Rakka.git] / Rakka / Storage / Types.hs
index 8a1904171fa2817ee3a9cbdcee548cac6982586e..28184a676e574d54989cecc80af2301dbb95a5b2 100644 (file)
@@ -1,6 +1,9 @@
 module Rakka.Storage.Types
     ( Storage(..)
     , IndexReq(..)
+    , SearchResult(..)
+    , HitPage(..)
+    , SnippetFragment(..)
     )
     where
 
@@ -19,5 +22,30 @@ data Storage
 
 
 data IndexReq
-    = SyncIndex
-    | SearchIndex !Condition !(TMVar [(PageName, RevNum)])
+    = RebuildIndex
+    | SyncIndex
+    | SearchIndex !Condition !(TMVar SearchResult)
+
+
+data SearchResult
+    = SearchResult {
+        srTotal :: !Int
+      , srPages :: ![HitPage]
+      }
+    deriving (Show, Eq)
+
+
+data HitPage
+    = HitPage {
+        hpPageName :: !PageName
+      , hpPageRev  :: !RevNum
+      , hpSnippet  :: [SnippetFragment]
+      }
+    deriving (Show, Eq)
+
+
+data SnippetFragment
+    = Boundary
+    | NormalText      !String
+    | HighlightedWord !String
+    deriving (Show, Eq)
\ No newline at end of file