]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/Storage/Types.hs
HitPage should contain more info
[Rakka.git] / Rakka / Storage / Types.hs
index 06870e65d82529bb722b45d7d415ba24800322b0..e9b848ba8cdab1527fba5db257c9ceed764288d5 100644 (file)
@@ -1,10 +1,14 @@
 module Rakka.Storage.Types
     ( Storage(..)
     , IndexReq(..)
+    , SearchResult(..)
+    , HitPage(..)
+    , SnippetFragment(..)
     )
     where
 
 import           Control.Concurrent.STM
+import           Data.Time
 import           Rakka.Page
 import           Subversion.Repository
 import           Subversion.Types
@@ -21,4 +25,30 @@ 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
+      , hpLastMod  :: UTCTime
+      , hpSummary  :: Maybe String
+      , hpSnippet  :: [SnippetFragment]
+      }
+    deriving (Show, Eq)
+
+
+data SnippetFragment
+    = Boundary
+    | NormalText      !String
+    | HighlightedWord !String
+    deriving (Show, Eq)
\ No newline at end of file