Safe Haskell | None |
---|---|
Language | Haskell98 |
Hunt.Index
Description
The index interface.
- class IndexValue (IVal i) => Index i where
- type IKey i :: *
- type IVal i :: *
- type ICon i :: Constraint
- search :: ICon i => TextSearchOp -> IKey i -> i -> [(IKey i, IntermediateValue)]
- searchSc :: ICon i => TextSearchOp -> IKey i -> i -> [(IKey i, (Score, IntermediateValue))]
- lookupRange :: ICon i => IKey i -> IKey i -> i -> [(IKey i, IntermediateValue)]
- lookupRangeSc :: ICon i => IKey i -> IKey i -> i -> [(IKey i, (Score, IntermediateValue))]
- insertList :: ICon i => [(IKey i, IntermediateValue)] -> i -> i
- insert :: ICon i => IKey i -> IntermediateValue -> i -> i
- deleteDocs :: ICon i => DocIdSet -> i -> i
- delete :: ICon i => DocId -> i -> i
- empty :: ICon i => i
- toList :: ICon i => i -> [(IKey i, IntermediateValue)]
- fromList :: ICon i => [(IKey i, IntermediateValue)] -> i
- unionWith :: ICon i => (IVal i -> IVal i -> IVal i) -> i -> i -> i
- map :: ICon i => (IVal i -> IVal i) -> i -> i
- mapMaybe :: ICon i => (IVal i -> Maybe (IVal i)) -> i -> i
- keys :: ICon i => i -> [IKey i]
- class Monad m => IndexM m i where
- type IKeyM i :: *
- type IValM i :: *
- type IConM i :: Constraint
- searchM :: IConM i => TextSearchOp -> IKeyM i -> i -> m [(IKeyM i, IntermediateValue)]
- searchMSc :: IConM i => TextSearchOp -> IKeyM i -> i -> m [(IKeyM i, (Score, IntermediateValue))]
- lookupRangeM :: IConM i => IKeyM i -> IKeyM i -> i -> m [(IKeyM i, IntermediateValue)]
- lookupRangeMSc :: IConM i => IKeyM i -> IKeyM i -> i -> m [(IKeyM i, (Score, IntermediateValue))]
- insertListM :: IConM i => [(IKeyM i, IntermediateValue)] -> i -> m i
- insertM :: IConM i => IKeyM i -> IntermediateValue -> i -> m i
- deleteDocsM :: IConM i => DocIdSet -> i -> m i
- deleteM :: IConM i => DocId -> i -> m i
- emptyM :: IConM i => m i
- toListM :: IConM i => i -> m [(IKeyM i, IntermediateValue)]
- fromListM :: IConM i => [(IKeyM i, IntermediateValue)] -> m i
- unionWithM :: IConM i => (IValM i -> IValM i -> IValM i) -> i -> i -> m i
- mapM :: IConM i => (IValM i -> IValM i) -> i -> m i
- mapMaybeM :: IConM i => (IValM i -> Maybe (IValM i)) -> i -> m i
- keysM :: IConM i => i -> m [IKeyM i]
- addDefScore :: [(a, b)] -> [(a, (Score, b))]
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.
Minimal complete definition
search, lookupRange, insertList, deleteDocs, empty, toList, fromList, unionWith, mapMaybe, keys
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 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.
Instances
Index PrefixTreeIndexDate | |
Index PrefixTreeIndexInt | |
Index SimplePrefixTreeIndex | |
Index PrefixTreeIndexPosition | |
Index InvertedIndex2Dim | |
Index InvertedIndex | |
Index SimpleRTreeIndex | |
IndexValue v => Index (DmPrefixTree v) | |
IndexValue v => Index (DmPrefixTree v) | |
IndexValue v => Index (RTreeIndex v) | |
IndexValue (IVal impl) => Index (KeyProxyIndex toType impl) |
class Monad m => IndexM m i where Source
Minimal complete definition
searchM, lookupRangeM, insertListM, deleteDocsM, emptyM, toListM, fromListM, unionWithM, mapMaybeM, keysM
Associated Types
The key type of the index.
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
.
addDefScore :: [(a, b)] -> [(a, (Score, b))] Source