| Copyright | Copyright (C) 2007 Timo B. Huebel |
|---|---|
| License | MIT |
| Maintainer | Timo B. Huebel (tbh@holumbus.org) |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell98 |
Hunt.Query.Result
Description
The data type for results of Holumbus queries.
The result of a query is defined in terms of two partial results, the documents containing the search terms and the words which are possible completions of the search terms.
- data Result e = Result {}
- type DocHits e = DocIdMap (DocInfo e, DocContextHits)
- type DocContextHits = Map Context DocWordHits
- type DocWordHits = Map Word Positions
- type WordHits = Map Word WordInfoAndHits
- type WordContextHits = Map Context WordDocHits
- type WordDocHits = DocBoosts
- data DocInfo e = DocInfo {}
- data WordInfo = WordInfo {}
- data WordInfoAndHits = WIH WordInfo WordContextHits
- data Score
- type Weight = Score
- type Boost = Score
- type DocBoosts = DocIdMap Score
- emptyResult :: Result e
- null :: Result e -> Bool
- sizeDocHits :: Result e -> Int
- sizeWordHits :: Result e -> Int
- maxScoreDocHits :: Result e -> Score
- maxScoreWordHits :: Result e -> Score
- getDocuments :: Result e -> [e]
- setDocScore :: Score -> DocInfo e -> DocInfo e
- setWordScore :: Score -> WordInfo -> WordInfo
Result data types
The combined result type for Holumbus queries.
Constructors
| Result | |
type DocHits e = DocIdMap (DocInfo e, DocContextHits) Source
A mapping from a document to it's score and the contexts where it was found.
type DocContextHits = Map Context DocWordHits Source
A mapping from a context to the words of the document that were found in this context.
type DocWordHits = Map Word Positions Source
A mapping from a word of the document in a specific context to it's positions.
type WordHits = Map Word WordInfoAndHits Source
A mapping from a word to it's score and the contexts where it was found.
type WordContextHits = Map Context WordDocHits Source
A mapping from a context to the documents that contain the word that were found in this context.
type WordDocHits = DocBoosts Source
A mapping from a document containing the word to the positions of the word.
Information about an document.
Constructors
| DocInfo | |
Information about a word.
Constructors
| WordInfo | |
data WordInfoAndHits Source
Constructors
| WIH WordInfo WordContextHits |
The score of a hit (either a document hit or a word hit). type Score = Float
Weight or score of a documents,
0.0 indicates: not set, so there is no need to work with Maybe's
wrapped in newtype to not mix up with Score's and Weight's in documents
Instances
| Eq Score | |
| Fractional Score | |
| Num Score | |
| Ord Score | |
| Show Score | |
| ToJSON Score | |
| FromJSON Score | |
| Monoid Score | |
| Binary Score | |
| NFData Score | |
| 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 ScoredDocs Score | aggregate scored docs to a single score by summing up the scores and throw away the DocIds |
Construction
emptyResult :: Result e Source
Create an empty result.
Query
sizeDocHits :: Result e -> Int Source
Query the number of documents in a result.
sizeWordHits :: Result e -> Int Source
Query the number of documents in a result.
maxScoreDocHits :: Result e -> Score Source
Query the maximum score of the documents.
maxScoreWordHits :: Result e -> Score Source
Query the maximum score of the words.
getDocuments :: Result e -> [e] Source
Extract all documents from a result.
Transform
setDocScore :: Score -> DocInfo e -> DocInfo e Source
Set the score in a document info.
setWordScore :: Score -> WordInfo -> WordInfo Source
Set the score in a word info.