solr-query-0.4.0: Solr query EDSL

Safe HaskellNone
LanguageHaskell2010

Solr.Query.Lucene

Contents

Synopsis

Lucene query

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.

int expression

int :: Int64 -> LuceneExpr TNum Source #

An int expression.

float expression

float :: Double -> LuceneExpr TNum Source #

A 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 #

A regular expression.

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 #

A DateTime expression. This may either be a timestamp (UTCTime), or a "truncated" DateTime such as (2015, 5, 12).

data DateTime Source #

DateTime literals. DateTime expressions are constructed using the internal IsDateTime typeclass, for which there exist the following instances:

instance IsDateTime UTCTime
instance IsDateTime Year
instance IsDateTime (Year, Month)
instance IsDateTime (Year, Month, Day)
instance IsDateTime (Year, Month, Day, Hour)
instance IsDateTime (Year, Month, Day, Hour, Minute)
instance IsDateTime (Year, Month, Day, Hour, Minute, Second)
instance IsDateTime (Year, Month, Day, Hour, Minute, Second, Millisecond)

type Year = Int Source #

Year.

type Month = Int Source #

1-indexed month. Clamped to the range 1-12.

type Day = Int Source #

1-indexed day. Clamped to the range 1-31.

type Hour = Int Source #

Hour. Clamped to the range 0-23.

type Minute = Int Source #

Minute. Clamped to the range 0-59.

type Second = Int Source #

Second. Clamped to the range 0-60.

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 #

Short-hand for fuzzing a word by 2. This is the default behavior of a Solr '~' operator without an integer added.

fuzzy e = e ~: 2

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 #

Short-hand for a greater-than range query.

gt e = excl e `to` star

gte :: Rangeable a TAny => LuceneExpr a -> LuceneExpr TRange Source #

Short-hand for a greater-than-or-equal-to range query.

gte e = incl e `to` star

lt :: Rangeable TAny a => LuceneExpr a -> LuceneExpr TRange Source #

Short-hand for a less-than range query.

 lt e = star `to` excl e

lte :: Rangeable TAny a => LuceneExpr a -> LuceneExpr TRange Source #

Short-hand for a less-than-or-equal-to range query.

lte e = star `to` incl e

data Boundary ty Source #

An inclusive or exclusive expression for use in a range query, built with either incl, excl, or star.

The constructors are exported for use in interpreters.

Instances

Eq (Boundary ty) Source # 

Methods

(==) :: Boundary ty -> Boundary ty -> Bool #

(/=) :: Boundary ty -> Boundary ty -> Bool #

Show (Boundary ty) Source # 

Methods

showsPrec :: Int -> Boundary ty -> ShowS #

show :: Boundary ty -> String #

showList :: [Boundary ty] -> ShowS #

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.

star :: Boundary TAny Source #

'*' operator, signifying the minimum or maximun bound of a range.

spatial predicate expressions

intersects :: Shape -> LuceneExpr TSpatialPredicate Source #

'Intersects' spatial predicate.

isWithin :: Shape -> LuceneExpr TSpatialPredicate Source #

'IsWithin' spatial predicate.

data Shape Source #

A shape.

polygon :: [(Double, Double)] -> Shape Source #

A POLYGON shape.

Lucene expression types

class Fuzzable ty Source #

words and phrases can fuzzed by the ~: operator.

Instances

TypeError Constraint (Text "You can only fuzz words and phrases") => Fuzzable a Source # 
Fuzzable TWord Source # 
Fuzzable TPhrase Source # 

class Boostable ty Source #

words and phrases can be boosted by the ^: operator.

Instances

TypeError Constraint (Text "You can only boost words and phrases") => Boostable a Source # 
Boostable TWord Source # 
Boostable TPhrase Source # 

class Rangeable a b Source #

ints, floats, words, and datetimes can to range expression.

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

data UTCTime :: * #

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.

Instances

Eq UTCTime 

Methods

(==) :: UTCTime -> UTCTime -> Bool #

(/=) :: UTCTime -> UTCTime -> Bool #

Data UTCTime 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCTime -> c UTCTime #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UTCTime #

toConstr :: UTCTime -> Constr #

dataTypeOf :: UTCTime -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c UTCTime) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UTCTime) #

gmapT :: (forall b. Data b => b -> b) -> UTCTime -> UTCTime #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCTime -> r #

gmapQ :: (forall d. Data d => d -> u) -> UTCTime -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCTime -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCTime -> m UTCTime #

Ord UTCTime 
NFData UTCTime 

Methods

rnf :: UTCTime -> () #

FormatTime UTCTime 
ParseTime UTCTime