Safe Haskell | None |
---|---|
Language | Haskell98 |
Common types used within Hunt.
- type URI = Text
- type Description = DocDesc
- type Title = Text
- type Content = Text
- type Position = Int
- type Context = Text
- type Word = Text
- type Words = Map Context WordList
- type WordList = Map Word [Position]
- data TextSearchOp
- = Case
- | NoCase
- | PrefixCase
- | PrefixNoCase
- type Weight = Score
- type RegEx = Text
- newtype Score = SC {}
- noScore :: Score
- mkScore :: Float -> Score
- getScore :: Score -> Maybe Float
- defScore :: Score
- toDefScore :: Score -> Score
- fromDefScore :: Score -> Score
- accScore :: [Score] -> Score
- class Monoid a where
- (<>) :: Monoid m => m -> m -> m
Documentation
type Description = DocDesc Source
The description of a document is a generic key value map.
data TextSearchOp Source
Text index
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
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 |
toDefScore :: Score -> Score Source
fromDefScore :: Score -> Score Source
class Monoid a where
The class of monoids (types with an associative binary operation that has an identity). Instances should satisfy the following laws:
mappend mempty x = x
mappend x mempty = x
mappend x (mappend y z) = mappend (mappend x y) z
mconcat =
foldr
mappend mempty
The method names refer to the monoid of lists under concatenation, but there are many other instances.
Minimal complete definition: mempty
and mappend
.
Some types can be viewed as a monoid in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtype
s and make those instances
of Monoid
, e.g. Sum
and Product
.
mempty :: a
Identity of mappend
mappend :: a -> a -> a
An associative operation
mconcat :: [a] -> a
Fold a list using the monoid.
For most types, the default definition for mconcat
will be
used, but the function is included in the class definition so
that an optimized version can be provided for specific types.