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

CopyrightCopyright (C) 2007 Timo B. Huebel
LicenseMIT
MaintainerTimo B. Huebel (tbh@holumbus.org)
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Hunt.Query.Result

Contents

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.

Synopsis

Result data types

data Result e Source

The combined result type for Holumbus queries.

Constructors

Result 

Fields

docHits :: DocHits e

The documents matching the query.

wordHits :: WordHits

The words which are completions of the query terms.

Instances

Show e => Show (Result e) 

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.

data DocInfo e Source

Information about an document.

Constructors

DocInfo 

Fields

document :: e

The document itself.

docBoost :: Weight

The document weight, init with 1.0

docScore :: Score

The score for the document (initial score for all documents is 0.0).

Instances

data WordInfo Source

Information about a word.

Constructors

WordInfo 

Fields

terms :: Terms

The search terms that led to this very word.

wordScore :: Score

The frequency of the word in the document for a context.

data Score Source

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

type Weight = Score Source

Weight (for ranking).

type Boost = Score Source

Boosting of a single document.

type DocBoosts = DocIdMap Score Source

Document boosting.

Construction

emptyResult :: Result e Source

Create an empty result.

Query

null :: Result e -> Bool Source

Test if the result contains anything.

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.