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

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

Hunt.Query.Ranking

Contents

Description

Version : 0.3

The ranking mechanism for Hunt.

Customized ranking functions for both documents and suggested words can be provided by the user. Some predefined ranking functions are avaliable, too.

Synopsis

Ranking types

data RankConfig e Source

The configuration of the ranking mechanism.

Constructors

RankConfig 

Fields

docRanking :: DocRanking e

A function to determine the score of a document.

wordRanking :: WordRanking

A function to determine the score of a word.

type DocRanking e = ContextWeights -> DocId -> Score -> DocInfo e -> DocContextHits -> Score Source

The signature of a function to determine the score of a document.

type WordRanking = Word -> WordInfo -> WordContextHits -> Score Source

The signature of a function to determine the score of a word.

type ContextWeights = Map Context Weight Source

Weights for the contexts (optional).

Ranking

rank :: (DocTable dt, Monad m, Applicative m) => RankConfig e -> dt -> ContextWeights -> Result e -> m (Result e) Source

Rank the result with custom ranking functions (and the given context weights).

Predefined document rankings

docRankByCount :: DocRanking e Source

Rank documents by count and multiply occurrences with their respective context weights (default 1.0). Pass an empty map to discard context weights.

docRankByCount :: ContextWeights -> DocId -> Score -> DocInfo e -> DocContextHits -> Score

Predefined word rankings

wordRankByCount :: WordRanking Source

Rank words by count.

wordRankByCount :: Word -> WordInfo -> WordContextHits -> Score

defaultRankConfig :: DocumentWrapper e => RankConfig e Source

The configuration of the ranking mechanism.