Safe Haskell | None |
---|---|

Language | Haskell98 |

The intermediate query results which have to be merged for the various combinatorial operations.

`toResult`

creates the final result which includes the document (and word) hits.

- class Monoid a => ScoredResult a where
- boost :: Score -> a -> a
- nullSC :: a -> Bool
- differenceSC :: a -> a -> a
- intersectSC :: a -> a -> a
- intersectDisplSC :: Int -> a -> a -> a
- intersectFuzzySC :: Int -> Int -> a -> a -> a

- class Aggregate a b where
- aggregate :: a -> b

- data ScoredDocs
- data ScoredWords
- type ScoredContexts = ScoredWords
- data ScoredOccs
- data ScoredRawDocs
- data ScoredCx a
- data UnScoredDocs
- newtype RankedDoc = RD {}
- toScoredDocs :: Occurrences -> ScoredDocs
- boostAndAggregateCx :: ScoredResult a => ScoredContexts -> ScoredCx a -> a
- fromCxRawResults :: CxRawResults -> ScoredCx ScoredRawDocs
- fromRawResult :: Context -> RawScoredResult -> ScoredCx ScoredRawDocs
- limitRawResult :: Int -> RawScoredResult -> RawScoredResult
- limitCxRawResults :: Int -> CxRawResults -> CxRawResults
- contextWeights :: Schema -> ScoredContexts
- filterByDocSet :: UnScoredDocs -> ScoredRawDocs -> ScoredRawDocs
- toDocIdSet :: UnScoredDocs -> DocIdSet
- toDocsResult :: (Applicative m, Monad m, DocTable dt) => dt -> ScoredDocs -> m [RankedDoc]
- toDocumentResultPage :: Int -> Int -> [RankedDoc] -> [RankedDoc]
- toWordsResult :: Int -> ScoredWords -> [(Word, Score)]
- evalSequence :: (ScoredResult r, Aggregate ScoredRawDocs r) => (ScoredCx ScoredRawDocs -> ScoredCx r) -> [ScoredCx ScoredRawDocs] -> ScoredCx r
- evalFollow :: (ScoredResult r, Aggregate ScoredRawDocs r) => (ScoredCx ScoredRawDocs -> ScoredCx r) -> Int -> [ScoredCx ScoredRawDocs] -> ScoredCx r
- evalNear :: (ScoredResult r, Aggregate ScoredRawDocs r) => (ScoredCx ScoredRawDocs -> ScoredCx r) -> Int -> [ScoredCx ScoredRawDocs] -> ScoredCx r
- evalOr :: ScoredResult a => [a] -> a
- evalAnd :: ScoredResult a => [a] -> a
- evalAndNot :: ScoredResult a => [a] -> a
- evalBoost :: ScoredResult a => Score -> a -> a
- evalPrim :: Aggregate (ScoredCx ScoredRawDocs) (ScoredCx r) => ScoredCx ScoredRawDocs -> ScoredCx r

# Documentation

class Monoid a => ScoredResult a where Source

boost :: Score -> a -> a Source

differenceSC :: a -> a -> a Source

intersectSC :: a -> a -> a Source

intersectDisplSC :: Int -> a -> a -> a Source

intersectFuzzySC :: Int -> Int -> a -> a -> a Source

class Aggregate a b where Source

Aggregate a a | allow no aggregation |

Aggregate ScoredRawDocs ScoredWords | aggregate the scored raw results by computing the score of all doc per word Used in completion search.
The sequence of words (in a phrase) is cut to the last word ( |

Aggregate ScoredRawDocs UnScoredDocs | aggregate scored raw results into an unscored result by throwing away the words, scores and occurrences |

Aggregate ScoredRawDocs ScoredDocs | aggregate scored raw results by throwing away the word hits and aggregating all document hits by throwing away the positions. The function for computing the scores of documents in a query |

Aggregate ScoredOccs Score | aggregate scored occurences to a score by aggregating first the positions and snd the doc ids used in computing the score of word in completion search |

Aggregate ScoredOccs UnScoredDocs | aggregate scored occurrences to unscored docs by throwing away the score |

Aggregate ScoredOccs ScoredDocs | aggregate scored occurences by counting the positions per doc and boost the result with the score. The positions in a doc are thrown away, so all kinds of phrase search become impossible |

Aggregate ScoredDocs Score | aggregate scored docs to a single score by summing up the scores and throw away the DocIds |

Aggregate a b => Aggregate (ScoredCx a) (ScoredCx b) | Lifting aggregation to scored context results |

data ScoredDocs Source

Show ScoredDocs | |

Monoid ScoredDocs | |

ScoredResult ScoredDocs | |

Aggregate ScoredRawDocs ScoredDocs | aggregate scored raw results by throwing away the word hits and aggregating all document hits by throwing away the positions. The function for computing the scores of documents in a query |

Aggregate ScoredOccs ScoredDocs | aggregate scored occurences by counting the positions per doc and boost the result with the score. The positions in a doc are thrown away, so all kinds of phrase search become impossible |

Aggregate ScoredDocs Score | aggregate scored docs to a single score by summing up the scores and throw away the DocIds |

data ScoredWords Source

Show ScoredWords | |

Monoid ScoredWords | |

ScoredResult ScoredWords | |

Aggregate ScoredRawDocs ScoredWords | aggregate the scored raw results by computing the score of all doc per word Used in completion search.
The sequence of words (in a phrase) is cut to the last word ( |

type ScoredContexts = ScoredWords Source

data ScoredOccs Source

Show ScoredOccs | |

Monoid ScoredOccs | |

ScoredResult ScoredOccs | |

Aggregate ScoredOccs Score | aggregate scored occurences to a score by aggregating first the positions and snd the doc ids used in computing the score of word in completion search |

Aggregate ScoredOccs UnScoredDocs | aggregate scored occurrences to unscored docs by throwing away the score |

Aggregate ScoredOccs ScoredDocs | aggregate scored occurences by counting the positions per doc and boost the result with the score. The positions in a doc are thrown away, so all kinds of phrase search become impossible |

data ScoredRawDocs Source

Show ScoredRawDocs | |

Monoid ScoredRawDocs | |

ScoredResult ScoredRawDocs | |

Aggregate ScoredRawDocs ScoredWords | aggregate the scored raw results by computing the score of all doc per word Used in completion search.
The sequence of words (in a phrase) is cut to the last word ( |

Aggregate ScoredRawDocs UnScoredDocs | aggregate scored raw results into an unscored result by throwing away the words, scores and occurrences |

Aggregate ScoredRawDocs ScoredDocs | aggregate scored raw results by throwing away the word hits and aggregating all document hits by throwing away the positions. The function for computing the scores of documents in a query |

Add the Context dimension to a scored result

data UnScoredDocs Source

The result type for unscored search of documents

used when all matching docs must be processed, e.g. in DeleteByQuery commands

Show UnScoredDocs | |

Monoid UnScoredDocs | |

ScoredResult UnScoredDocs | |

Aggregate ScoredRawDocs UnScoredDocs | aggregate scored raw results into an unscored result by throwing away the words, scores and occurrences |

Aggregate ScoredOccs UnScoredDocs | aggregate scored occurrences to unscored docs by throwing away the score |

boostAndAggregateCx :: ScoredResult a => ScoredContexts -> ScoredCx a -> a Source

The final op for a search result: boost the partial results of the contexts with the context weights from the schema and aggregate them by throwing away the contexts

fromCxRawResults :: CxRawResults -> ScoredCx ScoredRawDocs Source

limitCxRawResults :: Int -> CxRawResults -> CxRawResults Source

toDocIdSet :: UnScoredDocs -> DocIdSet Source

toDocsResult :: (Applicative m, Monad m, DocTable dt) => dt -> ScoredDocs -> m [RankedDoc] Source

convert a set of scored doc ids into a list of documents containing the score

This list may be further sorted by score, partitioned into pages or ...

toWordsResult :: Int -> ScoredWords -> [(Word, Score)] Source

evalSequence :: (ScoredResult r, Aggregate ScoredRawDocs r) => (ScoredCx ScoredRawDocs -> ScoredCx r) -> [ScoredCx ScoredRawDocs] -> ScoredCx r Source

combine a sequence of results from a phrase query into a single result
and aggregate this result into a simpler structure,
e.g. a `ScoredDocs`

or `ScoredWords`

value

The arguments must be of this unaggregated from, still containing word positions, else sequences of words are not detected

evalFollow :: (ScoredResult r, Aggregate ScoredRawDocs r) => (ScoredCx ScoredRawDocs -> ScoredCx r) -> Int -> [ScoredCx ScoredRawDocs] -> ScoredCx r Source

evalNear :: (ScoredResult r, Aggregate ScoredRawDocs r) => (ScoredCx ScoredRawDocs -> ScoredCx r) -> Int -> [ScoredCx ScoredRawDocs] -> ScoredCx r Source

evalOr :: ScoredResult a => [a] -> a Source

evalAnd :: ScoredResult a => [a] -> a Source

evalAndNot :: ScoredResult a => [a] -> a Source

evalBoost :: ScoredResult a => Score -> a -> a Source

evalPrim :: Aggregate (ScoredCx ScoredRawDocs) (ScoredCx r) => ScoredCx ScoredRawDocs -> ScoredCx r Source