hunt-searchengine-0.3.0.0: A search and indexing engine.

Safe HaskellNone
LanguageHaskell98

Hunt.ContextIndex

Contents

Description

The context index introduces contexts and combines the index, document table and schema.

Synopsis

Construction

Contexts and Schema

insertContext :: Context -> IndexImpl -> ContextSchema -> ContextIndex dt -> ContextIndex dt Source

Inserts a new context.

deleteContext :: Context -> ContextIndex dt -> ContextIndex dt Source

Removes context (including the index and the schema).

foreachContext :: (Functor m, Monad m) => [Context] -> (Context -> m res) -> m [(Context, res)] Source

contexts :: ContextMap -> [Context] Source

Contexts/keys of ContextMap.

contextsM :: (Monad m, DocTable dt) => ContextIndex dt -> m [Context] Source

All contexts of the index.

hasContext :: Context -> ContextMap -> Bool Source

Check if the context exists.

hasContextM :: (Monad m, DocTable dt) => Context -> ContextIndex dt -> m Bool Source

Does the context exist?

Queries

lookupRangeCx :: Monad m => Context -> Text -> Text -> ContextMap -> m [(Text, IntermediateValue)] Source

Range query in a context between first and second key.

searchWithCx :: Monad m => TextSearchOp -> Context -> Text -> ContextMap -> m [(Text, IntermediateValue)] Source

Search query in a context.

searchWithCxsNormalized :: (Functor m, Monad m) => TextSearchOp -> [(Context, Text)] -> ContextMap -> m [(Context, [(Text, IntermediateValue)])] Source

Search over a list of contexts and words

searchWithCxSc :: Monad m => TextSearchOp -> Context -> Text -> ContextMap -> m [(Text, (Score, Occurrences))] Source

Search query with scored results XXX TODO: this function should return intermediates and query processor should work with those

lookupRangeCxSc :: Monad m => Context -> Text -> Text -> ContextMap -> m [(Text, (Score, Occurrences))] Source

Range query in a context between first and second key. XXX TODO: this function should return intermediates and query processor should work with those

Insert/Delete Documents

insertList :: (MonadParallel m, Applicative m, DocTable dt) => [(DValue dt, Words)] -> ContextIndex dt -> m (ContextIndex dt) Source

Insert multiple documents and words.

unionDocTables :: (DocTable dt, MonadParallel m) => [(dt, [(DocId, Words)])] -> dt -> m (dt, [(DocId, Words)]) Source

modifyWithDescription :: (MonadParallel m, Applicative m, DocTable dt) => Score -> Description -> Words -> DocId -> ContextIndex dt -> m (ContextIndex dt) Source

Modify the description of a document and add words (occurrences for that document) to the index.

delete :: (MonadParallel m, Applicative m, DocTable dt) => DocIdSet -> ContextIndex dt -> m (ContextIndex dt) Source

Delete a set of documents by DocId.

deleteDocsByURI :: (MonadParallel m, Applicative m, DocTable dt) => Set URI -> ContextIndex dt -> m (ContextIndex dt) Source

Delete a set of documents by URI.

decodeCxIx :: (Binary dt, DocTable dt) => [IndexImpl] -> ByteString -> ContextIndex dt Source

Deserialize a ContextIndex with the list of available index implementations and a map of available ContextSchema.

Note: The serialized index implementations have to be in the list of available types, otherwise this will fail. The serialized schemas have to be in the list of available ContextSchema, otherwise this will fail as well.

member :: (Monad m, Applicative m, DocTable dt) => URI -> ContextIndex dt -> m Bool Source

Is the document part of the index?

Types

data ContextIndex dt Source

Context index introduces contexts and combines the major components of Hunt.

Constructors

ContextIndex 

Fields

ciIndex :: !ContextMap

Indexes associated to contexts.

ciDocs :: !dt

Document table.

Instances

type IndexRep = (ContextSchema, IndexImpl) Source

Contexts with associated heterogeneous index implementations.

mkContextMap :: Map Context IndexRep -> ContextMap Source

Strict smart constructor for the ContextMap.