Safe Haskell | None |
---|---|
Language | Haskell98 |
Schema for the ContextIndex
.
Every context has a type (e.g. text, int, date, position) and additional schema information. This includes how keys are splitted and normalized when inserted and searched for.
- type Schema = Map Context ContextSchema
- data ContextSchema = ContextSchema {
- cxRegEx :: Maybe RegEx
- cxNormalizer :: [CNormalizer]
- cxWeight :: Weight
- cxDefault :: Bool
- cxType :: ContextType
- data ContextType = CType {
- ctName :: Text
- ctRegEx :: RegEx
- ctValidate :: CValidator
- ctIxImpl :: IndexImpl
- type ContextTypes = [ContextType]
- data CValidator = CValidator {}
- data CNormalizer = CNormalizer {}
- normalize' :: [CNormalizer] -> Word -> Word
- ctText :: ContextType
- ctTextSimple :: ContextType
- ctInt :: ContextType
- ctDate :: ContextType
- ctPosition :: ContextType
- ctPositionRTree :: ContextType
- cnUpperCase :: CNormalizer
- cnLowerCase :: CNormalizer
- cnZeroFill :: CNormalizer
Types
type Schema = Map Context ContextSchema Source
The global schema assigning schema information to each context.
data ContextSchema Source
The context schema information. Every context schema has a type and additional to adjust the behavior.
The regular expression splits the text into words which are then transformed by the given normalizations functions (e.g. to lower case).
ContextSchema | |
|
data ContextType Source
A general context type like text or int.
CType | |
|
Show ContextType | |
ToJSON ContextType | |
FromJSON ContextType | Note: This is only partial (de-)serialization. The other components are environment-dependent and cannot be (de-)serialized. We serialize the name and identify the other compontens of the type later. |
Binary ContextType | |
Default ContextType |
type ContextTypes = [ContextType] Source
Set of context types.
data CNormalizer Source
Normalizer for words/keys of an index.
normalize' :: [CNormalizer] -> Word -> Word Source
Apply the normalizers to a word.
Default Context Types
Text context type.
ctTextSimple :: ContextType Source
Special text context type smaller index but not phrase queries possible (due to not storing the words positions)
Int context type.
Date context type.
ctPosition :: ContextType Source
Geographic position context type.
Default Normalizers
cnUpperCase :: CNormalizer Source
Uppercase normalizer "UpperCase".
cnLowerCase :: CNormalizer Source
Lowercase normalizer "LowerCase".
cnZeroFill :: CNormalizer Source
Int normalizer "ZeroFill" to preserve int ordering on strings.