]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Storage/Types.hs
improvements related to page search
[Rakka.git] / Rakka / Storage / Types.hs
index 06870e65d82529bb722b45d7d415ba24800322b0..28184a676e574d54989cecc80af2301dbb95a5b2 100644 (file)
@@ -1,6 +1,9 @@
 module Rakka.Storage.Types
     ( Storage(..)
     , IndexReq(..)
+    , SearchResult(..)
+    , HitPage(..)
+    , SnippetFragment(..)
     )
     where
 
@@ -21,4 +24,28 @@ data Storage
 data IndexReq
     = RebuildIndex
     | SyncIndex
-    | SearchIndex !Condition !(TMVar [(PageName, RevNum)])
+    | 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