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

Safe HaskellNone
LanguageHaskell98

Hunt.DocTable

Description

The document table interface.

Synopsis

Documentation

class DocumentWrapper (DValue i) => DocTable i where Source

The document table type class which needs to be implemented to be used by the Interpreter. The type parameter i is the implementation. The implementation must have a value type parameter.

Associated Types

type DValue i :: * Source

The value type of the document table.

Methods

null :: Monad m => i -> m Bool Source

Test whether the document table is empty.

size :: Monad m => i -> m Int Source

Returns the number of unique documents in the table.

lookup :: Monad m => DocId -> i -> m (Maybe (DValue i)) Source

Lookup a document by its ID.

lookupByURI :: Monad m => URI -> i -> m (Maybe DocId) Source

Lookup the DocId of a document by an URI.

union :: Monad m => i -> i -> m i Source

Union of two disjoint document tables. It is assumed, that the DocIds and the document URIs of both indexes are disjoint.

disjoint :: Monad m => i -> i -> m Bool Source

Test whether the DocIds of both tables are disjoint.

insert :: Monad m => DValue i -> i -> m (DocId, i) Source

Insert a document into the table. Returns a tuple of the DocId for that document and the new table. If a document with the same URI is already present, its id will be returned and the table is returned unchanged.

update :: Monad m => DocId -> DValue i -> i -> m i Source

Update a document with a certain DocId.

adjust :: Monad m => (DValue i -> m (DValue i)) -> DocId -> i -> m i Source

Update a document by DocId with the result of the provided function.

adjustByURI :: Monad m => (DValue i -> m (DValue i)) -> URI -> i -> m i Source

Update a document by URI with the result of the provided function.

delete :: Monad m => DocId -> i -> m i Source

Removes the document with the specified DocId from the table.

deleteByURI :: Monad m => URI -> i -> m i Source

Removes the document with the specified URI from the table.

difference :: Monad m => DocIdSet -> i -> m i Source

Deletes a set of documents by DocId from the table.

differenceByURI :: Monad m => Set URI -> i -> m i Source

Deletes a set of documents by URI from the table.

map :: Monad m => (DValue i -> DValue i) -> i -> m i Source

Map a function over all values of the document table.

filter :: Monad m => (DValue i -> Bool) -> i -> m i Source

Filters all documents that satisfy the predicate.

toMap :: Monad m => i -> m (DocIdMap (DValue i)) Source

Convert document table to a DocIdMap.

empty :: i Source

Empty DocTable.

Instances

restrict :: (Functor m, Monad m, Applicative m, DocTable i) => DocIdSet -> i -> m i Source

toJSON'DocTable :: (Functor m, Monad m, Applicative m, DocTable i) => i -> m Value Source

JSON dump of the document table.

fromJSON'DocTable :: (Functor m, Monad m, Applicative m, DocTable i) => Value -> m i Source

JSON import of the document table.