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

Safe HaskellNone
LanguageHaskell98

Hunt.Index

Description

The index interface.

Synopsis

Documentation

class IndexValue (IVal i) => Index i where Source

The index 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 IKey i :: * Source

The key type of the index.

type IVal i :: * Source

type ICon i :: Constraint Source

Methods

search :: ICon i => TextSearchOp -> IKey i -> i -> [(IKey i, IntermediateValue)] Source

General lookup function.

searchSc :: ICon i => TextSearchOp -> IKey i -> i -> [(IKey i, (Score, IntermediateValue))] Source

lookupRange :: ICon i => IKey i -> IKey i -> i -> [(IKey i, IntermediateValue)] Source

Search within a range of two keys.

lookupRangeSc :: ICon i => IKey i -> IKey i -> i -> [(IKey i, (Score, IntermediateValue))] Source

insertList :: ICon i => [(IKey i, IntermediateValue)] -> i -> i Source

Insert occurrences. This is more efficient than folding with insert.

insert :: ICon i => IKey i -> IntermediateValue -> i -> i Source

Insert occurrences.

deleteDocs :: ICon i => DocIdSet -> i -> i Source

Delete as batch job. This is more efficient than folding with delete.

delete :: ICon i => DocId -> i -> i Source

Delete occurrences.

empty :: ICon i => i Source

Empty index.

toList :: ICon i => i -> [(IKey i, IntermediateValue)] Source

Convert an index to a list. Can be used for easy conversion between different index implementations.

fromList :: ICon i => [(IKey i, IntermediateValue)] -> i Source

Convert a list of key-value pairs to an index.

unionWith :: ICon i => (IVal i -> IVal i -> IVal i) -> i -> i -> i Source

Merge two indexes with a combining function.

map :: ICon i => (IVal i -> IVal i) -> i -> i Source

Map a function over the values of the index.

mapMaybe :: ICon i => (IVal i -> Maybe (IVal i)) -> i -> i Source

Updates a value or deletes it if the result of the function is Nothing.

keys :: ICon i => i -> [IKey i] Source

Keys of the index.

class Monad m => IndexM m i where Source

Monadic version of Index. Index instances are automatically instance of this type class.

Associated Types

type IKeyM i :: * Source

The key type of the index.

type IValM i :: * Source

The value type of the index.

type IConM i :: Constraint Source

Methods

searchM :: IConM i => TextSearchOp -> IKeyM i -> i -> m [(IKeyM i, IntermediateValue)] Source

Monadic version of search.

searchMSc :: IConM i => TextSearchOp -> IKeyM i -> i -> m [(IKeyM i, (Score, IntermediateValue))] Source

Monadic version of search with (default) scoring.

lookupRangeM :: IConM i => IKeyM i -> IKeyM i -> i -> m [(IKeyM i, IntermediateValue)] Source

Monadic version of lookupRangeM.

lookupRangeMSc :: IConM i => IKeyM i -> IKeyM i -> i -> m [(IKeyM i, (Score, IntermediateValue))] Source

insertListM :: IConM i => [(IKeyM i, IntermediateValue)] -> i -> m i Source

Monadic version of insertList.

insertM :: IConM i => IKeyM i -> IntermediateValue -> i -> m i Source

Monadic version of insert.

deleteDocsM :: IConM i => DocIdSet -> i -> m i Source

Monadic version of deleteDocs.

deleteM :: IConM i => DocId -> i -> m i Source

Monadic version of delete.

emptyM :: IConM i => m i Source

Monadic version of empty.

toListM :: IConM i => i -> m [(IKeyM i, IntermediateValue)] Source

Monadic version of toList.

fromListM :: IConM i => [(IKeyM i, IntermediateValue)] -> m i Source

Monadic version of fromList.

unionWithM :: IConM i => (IValM i -> IValM i -> IValM i) -> i -> i -> m i Source

Monadic version of unionWith.

mapM :: IConM i => (IValM i -> IValM i) -> i -> m i Source

Monadic version of map.

mapMaybeM :: IConM i => (IValM i -> Maybe (IValM i)) -> i -> m i Source

Monadic version of mapMaybe.

keysM :: IConM i => i -> m [IKeyM i] Source

Monadic version of keys.

Instances

(Index i, Monad m) => IndexM m i 

addDefScore :: [(a, b)] -> [(a, (Score, b))] Source