-
Notifications
You must be signed in to change notification settings - Fork 22
Text Contains Clauses (Spider)
[Table of Contents](https://github.com/dell-oss/Doradus/wiki/Spider Databases: Table-of-Contents) | Previous | Next
Doradus Query Language: Text Contains Clauses
Text fields can be queried for values that contain specific terms. In contrast, equality clauses (described later) compare the entire field value.
A term clause searches a specific field for one or more terms. To designate it as a contains clause, the field name must be followed by a colon. Example:
Name:Smith
This clause searches perspective objects’ Name
field for the term Smith
(case-insensitive). To specify multiple terms, enclose them in parentheses. Example:
Name:(John Smith)
To match this clause, an object’s Name
field must contain both John
and Smith
, but they can appear in any order and be separated by other terms.
Be sure to enclose multi-term clauses in parentheses! The following query looks like it searches for John
and Smith
in the Name
field:
Name:John Smith // doesn’t do what you think!
But, this sequence is actually interpreted as two clauses that are AND-ed together:
Name:John AND *:Smith
Matching objects must have John
in the Name
field and Smith
in any field.
A phrase clause is a contains clause that searches for a field for a specific term sequence. Its terms are enclosed in single or double quotes. For example:
Name:"John Sm*th"
This phrase clause searches the Name
field for the term John
immediately followed by a term that matches the pattern Sm*th
. The matching terms may be preceded or followed by other terms, but they must be in the specified order and with no intervening terms. As with term clauses, phrases clauses can use wildcards, and searches are performed without case sensitivity.
Term and phrase clauses can search all fields of the perspective table by eliminating the field name qualifier. The simplest form of an any-field clause is a term clause:
John
This clause searches all scalar fields of the perspective table for a value contains the term John
(case-insensitive). All indexed scalar fields are searched, which means those whose analyzer is other than NullAnalyzer
. Fields indexed with the OpaqueTextAnalyzer
will match only if the field’s value equals John
. Fields that use other analyzers will match if they contain the term John
. However, Boolean, timestamp, and numeric fields do not contain text terms, so they will never contain a text term such as John
.
However, suppose we perform an any-field search for an integer value:
12226
If an object has a text field called MessageID
with the value "Host1-12226-Alpha1
", 12226 is one the terms generated by the field, hence the above clause would match the field. If another object has an integer field called Size
whose value is 12226, it would also match since the IntegerAnalyzer
generates a term equal to the field’s value. Hence, objects could match a term clause based on the type of terms generated by their scalar field analyzers.
Multiple terms can be provided by separating them by at least one space. For example:
John Smith
This multi-term clause searches for the terms John
and Smith
in any order and across any field. For example, an object will match if it has a FirstName
field that contains John
and a LastName
field that contains Smith
. If all terms are contained in the same field, they can appear in any order and be separated by other terms. For example, an object will match the example above if it has a Name
field whose value is "John Smith
", “John Q. Smith
”, or “Smith, John
”.
An any-field clause can be requested using the field qualifier syntax by using the field name "*". Example:
*:(John Smith)
This is the same as the unqualified term clause:
John Smith
Phrase clauses can also use the field qualifier syntax and request an any-field search:
*:"John Smith"
This query finds object where the terms John
and Smith
appear in succession in any field. The phrase can be preceded or followed by other terms.
Technical Documentation
[Doradus OLAP Databases](https://github.com/dell-oss/Doradus/wiki/Doradus OLAP Databases)
- Architecture
- OLAP Database Overview
- OLAP Data Model
- Doradus Query Language (DQL)
- OLAP Object Queries
- OLAP Aggregate Queries
- OLAP REST Commands
- Architecture
- Spider Database Overview
- Spider Data Model
- Doradus Query Language (DQL)
- Spider Object Queries
- Spider Aggregate Queries
- Spider REST Commands
- [Installing and Running Doradus](https://github.com/dell-oss/Doradus/wiki/Installing and Running Doradus)
- [Deployment Guidelines](https://github.com/dell-oss/Doradus/wiki/Deployment Guidelines)
- [Doradus Configuration and Operation](https://github.com/dell-oss/Doradus/wiki/Doradus Configuration and Operation)
- [Cassandra Configuration and Operation](https://github.com/dell-oss/Doradus/wiki/Cassandra Configuration and Operation)