Safe Haskell | None |
---|---|
Language | Haskell2010 |
Solr.Query.Lucene
Contents
- data LuceneQuery
- defaultField :: LuceneExpr ty -> LuceneQuery
- (=:) :: Text -> LuceneExpr ty -> LuceneQuery
- field :: Text -> LuceneExpr ty -> LuceneQuery
- (^=:) :: LuceneQuery -> Float -> LuceneQuery
- score :: LuceneQuery -> Float -> LuceneQuery
- data LuceneExpr t
- int :: Int64 -> LuceneExpr TNum
- float :: Double -> LuceneExpr TNum
- true :: LuceneExpr TBool
- false :: LuceneExpr TBool
- word :: Text -> LuceneExpr TWord
- wild :: Text -> LuceneExpr TWild
- regex :: Text -> LuceneExpr TRegex
- phrase :: [LuceneExpr TWord] -> LuceneExpr TPhrase
- datetime :: IsDateTime a => a -> LuceneExpr TDateTime
- data DateTime
- type Year = Int
- type Month = Int
- type Day = Int
- type Hour = Int
- type Minute = Int
- type Second = Int
- type Millisecond = Double
- (~:) :: Fuzzable a => LuceneExpr a -> Int -> LuceneExpr TFuzzy
- fuzz :: Fuzzable a => LuceneExpr a -> Int -> LuceneExpr TFuzzy
- fuzzy :: LuceneExpr TWord -> LuceneExpr TFuzzy
- (^:) :: Boostable a => LuceneExpr a -> Float -> LuceneExpr TBoosted
- boost :: Boostable a => LuceneExpr a -> Float -> LuceneExpr TBoosted
- to :: Rangeable a b => Boundary a -> Boundary b -> LuceneExpr TRange
- gt :: Rangeable a TAny => LuceneExpr a -> LuceneExpr TRange
- gte :: Rangeable a TAny => LuceneExpr a -> LuceneExpr TRange
- lt :: Rangeable TAny a => LuceneExpr a -> LuceneExpr TRange
- lte :: Rangeable TAny a => LuceneExpr a -> LuceneExpr TRange
- data Boundary ty
- incl :: LuceneExpr a -> Boundary a
- excl :: LuceneExpr a -> Boundary a
- star :: Boundary TAny
- intersects :: Shape -> LuceneExpr TSpatialPredicate
- isWithin :: Shape -> LuceneExpr TSpatialPredicate
- data Shape
- polygon :: [(Double, Double)] -> Shape
- data LuceneExprTy
- class Fuzzable ty
- class Boostable ty
- class Rangeable a b
- df :: Text -> LocalParams LuceneQuery -> LocalParams LuceneQuery
- opAnd :: LocalParams LuceneQuery -> LocalParams LuceneQuery
- opOr :: LocalParams LuceneQuery -> LocalParams LuceneQuery
- data UTCTime :: *
Lucene query
data LuceneQuery Source #
Instances
defaultField :: LuceneExpr ty -> LuceneQuery Source #
A default field query.
(=:) :: Text -> LuceneExpr ty -> LuceneQuery infix 7 Source #
A field query.
field :: Text -> LuceneExpr ty -> LuceneQuery Source #
Named version of (=:
).
(^=:) :: LuceneQuery -> Float -> LuceneQuery infixr 6 Source #
The '^='
constant score operator.
This is given right-fixity to reject queries like q ^= 1 ^= 2
.
score :: LuceneQuery -> Float -> LuceneQuery infixr 6 Source #
Named version of (^=:
).
Lucene expression
data LuceneExpr t Source #
A lucene
expression.
Instances
Eq (LuceneExpr t) Source # | |
Show (LuceneExpr t) Source # | |
IsString (LuceneExpr TWord) Source # | |
int
expression
float
expression
bool
expressions
true :: LuceneExpr TBool Source #
A true
expression.
false :: LuceneExpr TBool Source #
A false
expression.
word
expression
word :: Text -> LuceneExpr TWord Source #
A single word. Must not contain any spaces, wildcard characters
('?'
and '*'
), or tildes ('~'
), though this is not enforced by
the type system.
Note that sometimes you may use the IsString
instance for
LuceneExpr
TWord
, but usually an explicit type signature
will be required (at the interpretation site or earlier).
wild
expression
wild :: Text -> LuceneExpr TWild Source #
A single word that may contain wildcard characters ('?'
and '*'
),
although the meaning of consecutive '*'
s is probably ill-defined. Must
also not contain any spaces or tildes ('~'
), though this is not
enforced by the type system.
regex
expression
regex :: Text -> LuceneExpr TRegex Source #
Note that the leading and trailing '/'
must be omitted. The regex
innards are not type checked in any way.
phrase
expression
phrase :: [LuceneExpr TWord] -> LuceneExpr TPhrase Source #
A phrase, composed of multiple (non-fuzzy) words, none of which may
contain wildcard characters. Both of these properties are enforced by the
type system, as long as the words themselves adhere to the word
contract.
The list should not be empty.
datetime
expression
datetime :: IsDateTime a => a -> LuceneExpr TDateTime Source #
DateTime
literals. DateTime
expressions are constructed using the
internal IsDateTime
typeclass, for which there exist the following
instances:
instanceIsDateTime
UTCTime
instanceIsDateTime
Year
instanceIsDateTime
(Year
,Month
) instanceIsDateTime
(Year
,Month
,Day
) instanceIsDateTime
(Year
,Month
,Day
,Hour
) instanceIsDateTime
(Year
,Month
,Day
,Hour
,Minute
) instanceIsDateTime
(Year
,Month
,Day
,Hour
,Minute
,Second
) instanceIsDateTime
(Year
,Month
,Day
,Hour
,Minute
,Second
,Millisecond
)
type Millisecond = Double Source #
Millisecond. Clamped to the range 0-99.999
.
fuzz
expression
(~:) :: Fuzzable a => LuceneExpr a -> Int -> LuceneExpr TFuzzy infix 9 Source #
The '~'
operator, which fuzzes its argument (either a word or phrase)
by a numeric amount.
fuzz :: Fuzzable a => LuceneExpr a -> Int -> LuceneExpr TFuzzy Source #
Named version of (~:
).
fuzzy :: LuceneExpr TWord -> LuceneExpr TFuzzy Source #
boost
expression
(^:) :: Boostable a => LuceneExpr a -> Float -> LuceneExpr TBoosted infix 9 Source #
The '^'
operator, which boosts its argument.
boost :: Boostable a => LuceneExpr a -> Float -> LuceneExpr TBoosted Source #
Named version of (^:
).
range
expressions
to :: Rangeable a b => Boundary a -> Boundary b -> LuceneExpr TRange infix 9 Source #
A range expression.
gt :: Rangeable a TAny => LuceneExpr a -> LuceneExpr TRange Source #
gte :: Rangeable a TAny => LuceneExpr a -> LuceneExpr TRange Source #
lt :: Rangeable TAny a => LuceneExpr a -> LuceneExpr TRange Source #
lte :: Rangeable TAny a => LuceneExpr a -> LuceneExpr TRange Source #
incl :: LuceneExpr a -> Boundary a Source #
Mark an expression as inclusive, for use in a range query.
excl :: LuceneExpr a -> Boundary a Source #
Mark an expression as exclusive, for use in a range query.
spatial predicate
expressions
intersects :: Shape -> LuceneExpr TSpatialPredicate Source #
'Intersects'
spatial predicate.
isWithin :: Shape -> LuceneExpr TSpatialPredicate Source #
'IsWithin'
spatial predicate.
Lucene expression types
data LuceneExprTy Source #
word
s and phrase
s can fuzzed by the ~:
operator.
word
s and phrase
s can be boosted by the ^:
operator.
int
s, float
s, word
s, and datetime
s can to
range expression.
Instances
TypeError Constraint (Text "You can only use numbers, words, and dates in a range expression") => Rangeable a b Source # | |
Rangeable TAny TAny Source # | |
Rangeable TAny TNum Source # | |
Rangeable TAny TWord Source # | |
Rangeable TAny TDateTime Source # | |
Rangeable TNum TAny Source # | |
Rangeable TNum TNum Source # | |
Rangeable TWord TAny Source # | |
Rangeable TWord TWord Source # | |
Rangeable TDateTime TAny Source # | |
Rangeable TDateTime TDateTime Source # | |
Local parameters
df :: Text -> LocalParams LuceneQuery -> LocalParams LuceneQuery Source #
The 'df'
local parameter.
opAnd :: LocalParams LuceneQuery -> LocalParams LuceneQuery Source #
The 'op=AND'
local parameter.
opOr :: LocalParams LuceneQuery -> LocalParams LuceneQuery Source #
The 'op=OR'
local parameter.
Re-exports
This is the simplest representation of UTC. It consists of the day number, and a time offset from midnight. Note that if a day has a leap second added to it, it will have 86401 seconds.