A search query consists of the following elements:
Terms
Terms are the words that you want your search results to include or exclude. A term could be one word (eg Electrician), or it can be a phrase (eg "Fitter and Turner"). When searching for phrases, you need to surround the group of words in double quotes. Omitting the double quotes, means that your search will return results that include ANY of the words in the phrase. The following search term examples illustrate this concept:
"fitter turner" — Will only return results that include all of the words, in that exact same order
fitter turner — Will return records that include either 'fitter' OR 'turner'
Every search query must include at least one term.
Fields
Fields are the 'columns' in the search index definition. Specifying a field in your search query lets you search a specific 'column' in the search index definition. To specify a field, type the field name followed by a colon (:), and then the term you are looking for. For example, if you want to search the 'Name' field for all documents that contain 'John', use the following search query:
Name:John
Keep in mind that the field is only valid for the term that follows the colon. If you want to search a field for a phrase, be sure to include the group of words in double quotes.
Fields are optional.
Operators
Operators are used to combine or exclude terms to form more complex search queries. On Key Search supports the following search operators:
Operator |
Description | Example |
AND |
Used to return results that contain all of the specified terms. | Example 1: To search for all documents that contain 'John' and 'Black', use the following search query:
Example 2: To search for all documents that contain 'John' in the Name field, and 'fitter and turner' in the Trade field, use the following search query:
|
OR |
Used to return results that contain any of the specified terms. This is the default search operator. If you do not specify an operator between search terms, the OR operator will be used by default. |
Example 1: To search for all documents that contain either 'John' or 'Black', use the following search query:
Example 2: To search for all documents that contain either 'John' in the Name field, or 'fitter and turner' in the Trade field, use the following search query:
|
NOT |
Used to exclude results that contain the specified terms. | Example 1: To search for all documents that do not contain 'John', use the following search query:
Example 2: To search for all documents that do not contain 'fitter and turner' in the Trade field, use the following search query:
|
+ |
Used to specify terms that the search results must contain. | Example 1: To search for all documents that must contain 'John', use the following search query:
Example 2: To search for all documents that must contain 'fitter and turner' in the Trade field, use the following search query:
|
- |
Used to specify terms that the search results must not contain. | Example 1: To search for all documents that do not contain 'John', use the following search query:
Example 2: To search for all documents that do not contain 'fitter and turner' in the Trade field, use the following search query:
|
On Key Search allows you to group terms and operators into clauses using parenthesis. This enables you to control the boolean logic in search queries that have multiple operators. For example, to search for either 'John' or 'Jack' and 'Electrician', use the following search query:
(John OR Jack) AND Electrician
On Key Search supports the following search term modifiers:
Modifier | Description | Example |
Wildcard |
Used to substitute one or more characters in a single search term. To substitute a single character, use the '?' wildcard. To substitute multiple characters, use the '*' wildcard. |
Single character example: To search for documents that contain 'test' or 'text', use the following search query:
Multiple character example: To search for documents that contain 'test', 'tests', 'tester', or 'testing', use the following search query:
|
Fuzzy | Used to search for documents that contain values that are similar to the specified terms. Fuzzy searches are based on the Levenshtein Distance, or Edit Distance algorithm. |
To search for documents that contain terms that are similar in spelling to 'roam', use the following search query:
|
Proximity | Used to search for two words that appear within a set amount of words from each other. | To search for documents that contain 'this is a new test', 'this was the new test', or 'this will be new test', use the following search query:
|
Range | Used to return results where the values in a specific field are between specified upper and lower bounds. Range searches can be inclusive or exclusive. |
Inclusive example: To search for records where the value in the Quantity field is between and including 3 and 9, use the following search query:
Exclusive example: To search for records where the value in the Quantity field is between but excluding 3 and 9, use the following search query:
|
Boosting | Used to increase the relevance of certain terms in a search query. Use the ^ symbol along with the boost factor next to the term. The default boost factor is 1. |
To search for records that contain 'John' or 'fitter and turner', and place more emphasis on the trade, use the following search query:
|