Text.HyperEstraier.Condition
Contents
Description
An interface to functions to manipulate search conditions.
- data Condition
- data CondOption
- data SearchSpeed
- = Slow
- | Normal
- | Fast
- | EvenFaster
- data SyntaxType
- = Simplified
- | Rough
- | Union
- | Intersection
- data Eclipse
- newCondition :: IO Condition
- setPhrase :: Condition -> Text -> IO ()
- addAttrCond :: Condition -> Text -> IO ()
- setOrder :: Condition -> Text -> IO ()
- setMax :: Condition -> Int -> IO ()
- setSkip :: Condition -> Int -> IO ()
- setOptions :: Condition -> [CondOption] -> IO ()
- setAuxiliary :: Condition -> Int -> IO ()
- setEclipse :: Condition -> Eclipse -> IO ()
- setDistinct :: Condition -> Text -> IO ()
- setMetaSearchMask :: Condition -> [Int] -> IO ()
Types
data CondOption
CondOption
is an option to the search condition.
Constructors
Speed SearchSpeed | Choose a |
OmitTFIDF | Omit calculating TF-IDF weight. |
Syntax SyntaxType | Choose a |
Instances
data SearchSpeed
SearchSpeed
is an option to the search condition.
Constructors
Slow | Search for all N-gram keys. |
Normal | Search for N-gram keys alternately. |
Fast | Search for N-gram keys by skipping 2/3 of them. |
EvenFaster | Search for N-gram keys by skipping 3/4 of them. |
Instances
data SyntaxType
SyntaxType
is an option to the search condition.
Constructors
Simplified | Interpret the condition phrase as the simplified syntax. See the user's guide of the HyperEstraier for explanation about the simplified syntax. |
Rough | Interpret the condition phrase as the rough syntax. See the user's guide for details. |
Union | Interpret the condition phrase as the union syntax. See the user's guide for details. |
Intersection | Interpret the condition phrase as the intersection syntax. See the user's guide for details. |
Instances
data Eclipse
Eclipse
represents how to hide documents from the search
result by their similarity.
Constructors
Threshold Double | Threshold to cause eclipse to
documents. |
ThresholdWithURL Double | This is similar to |
SameServer | Cause eclipse to the documents on the same server. |
SameDirectory | Cause eclipse to the documents in the same directory. |
SameFile | Cause eclipse to the documents whose file name is the same. |
Manipulating conditions
newCondition
creates an empty search condition.
setPhrase :: Condition -> Text -> IO ()
stores a condition phrase into
setPhrase
cond phrasecond
. The syntax of the phrase is assumed to be the normal
syntax, unless you specify a SyntaxType
explicitly with
setOptions
.
addAttrCond :: Condition -> Text -> IO ()
appends an attribute search condition to
addAttrCond
cond exprcond
. See the user's guide for explanation about the attribute
search condition.
setOrder :: Condition -> Text -> IO ()
stores an ordering expression into
setOrder
cond exprcond
. See the user's guide for explanation about the ordering
expression. By default, the result is sorted in descending order of
score.
setMax :: Condition -> Int -> IO ()
specifies the maximum number of results. By
default, the number of results is unlimited.
setMax
cond n
setSkip :: Condition -> Int -> IO ()
specifies how many documents should be skipped
from the beginning of result.
setSkip
cond n
setOptions :: Condition -> [CondOption] -> IO ()
specifies options to the search
condition.
setOptions
cond opts
setAuxiliary :: Condition -> Int -> IO ()
specifies how many documents should be
in the result to avoid using the auxiliary index to pad the result.
setAuxiliary
cond min
setEclipse :: Condition -> Eclipse -> IO ()
specifies how to hide documents from the
search result by their similarity.
setEclipse
cond ecl
setDistinct :: Condition -> Text -> IO ()
specifies an attribute which must be
unique to the search result.
setDistinct
cond attr
setMetaSearchMask :: Condition -> [Int] -> IO ()
specifies that, in
setMetaSearchMask
cond xsText.HyperEstraier.Database.metaSearch
, some databases must be
excluded from the search result. e.g.
main = withDatabase "db1" (Reader []) $ \ db1 withDatabase "db2" (Reader []) $ \ db2 withDatabase "db3" (Reader []) $ \ db3 do cond <- newCondition setPhrase cond "hello AND world" setMetaSearchMask cond [0, 2] -- zero-origin -- In this case, "db1" and "db3" are excluded from the meta search. result <- metaSearch [db1, db2, db3] print result