Configuration : Appendix - ELLQL Language : Simple Operators
 
Simple Operators
 
Fields Search
Specials
Delimiters
Fields Search
Each type of field is associated with a query operator.
Alphanumeric Fields Operators
Alphanum
Syntax
Options
Examples
#alphanum{alphanum_options}(field, "term")
k=int (required) - specifies on which field matching mode (indexing level) the operator is applied. k may take any value that is described within the Linguistic.xml configuration file.
Classical ones are the following:
0 - exact indexing level,
1 - lowercase indexing level,
2 - normalized indexing level. Note: In the Administration Console, the default value for every new field is 2, but you are free to define your own values in the Linguistic.xml file.
nbdocs=int - specifies the number of documents that contain the term. This value is then used to compute IDF (Inverse Document Frequency), which is required to calculate the TFIDF values used for ranking.
Note: This value is generally automatically set when ELLQL is generated from UQL queries.
source=value - used by the debugger to specify the node's origin. It may be really helpful when debugging complex ELLQL expressions.
Search the term house in the title normalized field (k=2)
#alphanum{k=2}(title, "house")
Search the term house in the title normalized field (k=2), knowing that there are only 3 documents in the corpus containing the term house
#alphanum{k=2, nbdocs=3}(title, "house")
Anumpattern
Possible patterns:
prefix/suffix/substring search
missing characters search, for example, ?i?e must match bite and rime. In that case, ? is called the missing character marker.
full pattern search, for example, *?i*?e must match bite, rime, resize, linearize, but not image nor wheelie. * is the wildcard.
Syntax
Options
Examples
#anumpattern{options}(field, "term")
all the alphanum_options
type={prefix, suffix, substring, missingChars, fullPattern} - default is fullPattern
mcmarker=CHAR - default is ?
wildcard=CHAR - default is *
missingchars
Note: pattern search is activated for a prefix handler when enabled at the data model level
Search all terms with substring lot, for example, lottery, Camelot, slotted, in the text normalized field (k=2):
#anumpattern{k=2,type="substring"}(text, "lot")
Search all terms with missing chars ?i?e, for example, rime, rite, mime, in the title normalized field (k=2):
#anumpattern{k=2,type="missingChars"}(title, "?i?e")
or:
#anumpattern{k=2,type="missingChars", mcmarker="X"}(title, "XiXe")
Numerical Fields
Num
Syntax
Options
Examples
#num{num_option}(field, operator, value)
Since fields may be multivalued, the num_option allows you to customize the comparison policy.
The following options are accepted:
any - If any value matches the condition.
all - If all values need to match the condition.
none - If no value has to match the condition.
operator possible values:
Comparison operators: <, <=, >, >=, == or = (equals to), !=
Range operator that requires two values: the syntax then becomes #num{num_options}(field, <=>, from_value, to_value).
Search for documents with a size greater than 100.
#num(document_file_size, >, 100)
Search for documents where the prices field value is contained between $2.50 and $9.99.
#num(prices, <=>, 2.5, 9.99)
Search for documents where one of the values of the prices multivalued field is equal to $5.
#num{any}(prices, ==, 5)
Search for documents where all the values of the prices multivalued numerical field are under $5.
#num{all}(prices, <=, 5)
Around
Syntax
Options
#around{around_option}(field, value)
Search for document where the field value is around the value argument.
Same options as #num apply
Additional options are lowerBound and upperBound, with defaults to negative infinity and positive infinity. Only values within these bounds can be returned.
The generic name option allows you to calculate the difference, diff, between the value and the returned value. For example, if #around{name=NAME}(field, 10) returns 5, then NAME.diff = -5.
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 NumericalFields that are not searchable but only retrievable and RAM-based.
Search for a numerical field with a value greater than 100
#attrnum(myfield, > , 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(myfield, <=>, 2.5, 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(myfield, mymeta, > , 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
#attrnum(myfield, mymeta, <=> , 20, 100)
Category Fields
Category
Syntax
Example
#category{options}(field, "value")
Search documents in the Top/Source/default category:
#category(categories, "Top/Source/default")
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 polygon2, polygon3, etc. to polygon1
Important: When two polygons share a common segment, the behavior is undefined.
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.
Specials
#true{options}() - returns all documents (#all in UQL becomes #true in ELLQL)
#false{options}() - returns nothing
#did{options}(5 10 45) - returns the specified DIDs (here 5, 10 and 45)
Delimiters
Some operators allow you to detect delimiters within a document.
#page{options}(field) - page delimiter
#paragraph{options}(field) - paragraph delimiter
#sentence{options}(field) - sentence delimiter
They are mostly used with the #split operator, that is itself the expansion of the split prefix handler.
For example, if you define a split prefix handler of type insentence, you can then enter a query such as insentence:(texta AND textb). This query corresponds to the search of documents where texta and textb appear within the same sentence in the text field.
This UQL query is expanded as:#split(#and(#alphanum(text, "a") #alphanum(text, "b")), #sentence(text))