Fields Search
Each type of field is associated with a query operator.
Alphanumeric Fields Operators
Alphanum
Syntax | Options | Examples |
---|---|---|
#alphanum{alphanum_options}(field, "term")
|
|
Search the term
Search the term
|
Anumpattern
Possible patterns:
-
prefix/suffix/substring
search -
missing characters
search, for example,?i?e
must matchbite
andrime
. In that case,?
is called the missing character marker. -
full pattern
search, for example,*?i*?e
must matchbite, rime, resize, linearize
, but notimage
norwheelie. *
is the wildcard.
Syntax | Options | Examples |
---|---|---|
#anumpattern{options}(field, "term")
|
|
Search all terms with substring
Search all terms with missing chars
or:
|
Numerical Fields
Num
Syntax | Options | Examples |
---|---|---|
#num{num_option}(field, operator, value)
|
Since fields may be multivalued, the The following options are accepted:
|
|
Around
Syntax | Options | |
---|---|---|
#around{around_option}(field, value)
|
Search for document where the field value is
|
Search any value of field around 50 ranged
between 0 and 100. The resulting diff between the found value
and 50 is stored in the around.diff .
#around{lowerBound=0,upperBound=100, name="around"}(field, 50) <Hit> [...] <metas> <Meta name="field"> <MetaString name="value">75</MetaString> </Meta> </metas> <infos> <HitInfo key="ranking.around.diff" value="25"/> <infos> </Hit> |
Attrnum
Syntax | Use | Example |
---|---|---|
#attrnum{options}(field, operator, value)
|
Allows you to search |
Search for a numerical field with a value greater than 100
|
#attrnum{options}(field, <=>, from_value, to_value)
|
Allows you to search for ranges on
NumericalFields ; where field is the name of
numerical field, from_value is the start value, and
to_value the end value of the range. |
Search for fields where the prices field value is contained between $2.50 and $9.99
|
#attrnum{options}(field, meta, operator, value)
|
Allows you to search DynamicNumericalFields
that are not searchable but only retrievable and RAM-based. |
Search for documents where the "myfield" dynamic numerical field has a "mymeta" meta with a value greater than 100
|
#attrnum{options}(field, meta, <=>, from_value, to_value)
|
Allows you to search for ranges on
DynamicNumericalFields ; where field is the
name of dynamic numerical field, meta is the name of meta to
compare, from_value is the start value, and
to_value the end value of the range. |
Search for documents where the "myfield" dynamic numerical field has a "mymeta" meta with a range of values between 20 and 100
|
Category Fields
Category
Syntax | Example |
---|---|
#category{options}(field, "value")
|
Search documents in the
|
Uid Fields
Uid
Syntax | Use |
---|---|
#uid{options}(field, "value1" "value2" "value3")
|
Search for documents where the Uid field value is one of
value1, value2, value3 . All possible values are listed
separated with quotes. |
Geographical Search
Geographical search may be applied as soon as fields of type point are stored in the index.
Distance
Syntax | Use |
---|---|
#distance{options}(field, lat, lng, distance_in_meters)
|
Retrieve all the documents with a field describing a
position (a point) within distance_in_meters meters from
(lat, lng ) |
Example:
The following search area:
is expressed with:#distance(field, 1, 2, 1)
Within
Syntax | Use | |
---|---|---|
#within{options}(field, polygon)
|
Search for positions stored in the field
that are contained within the polygon
|
|
Simple polygon: (lat1,lng1; lat2, lng2; lat3, lng3,
...)
|
||
Multiple polygons: [polygon1 polygon2 ...]
|
When specifying more than one polygon, the search zone is composed of
subtracting zones described by polygons
|
Examples:
- The following search area:
is expressed with:
#within(field, (0, 1; 1, 1; 1, 0; 2, 2; 1, 3; 0, 1))
- The following area:
is expressed with:
#within(field, [(0, 1; 1, 1; 1, 0; 2, 2; 1, 3; 0, 1) (1, 2; 1, 1.5; 1.5, 1.5; 1, 2)])
-
Two overlapping polygons produce a symmetric difference as illustrated with:
expressed as:
#within(field, [(0, 0; 2, 0; 2, 1; 0, 2) (1, 1; 2, 1; 2, 3; 1, 3)])
Important: When two polygons share a common segment, the behavior is undefined.