Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Info

Information valid from AMI version 8.0sp2


Summary

AMI uses Elasticsearch  Simple Query String queries to perform free-text search. This lets you control aspects of a search using a basic Query String Syntax.

Free-text searches are used in the Search filter and for facets indexed as Text.


Table of Contents
maxLevel2



Terms

Search terms are searched for word by word. For example, if you entered the search terms onion rings then AMI would show results that had values that included either rings or onion: values of gold rings and red onions would both be valid matches, not just onion rings.

You can search for complete phrases by enclosing terms in double quote " characters. Entering "onion rings" would not match values of either gold rings or red onions.

When attributes are indexed for searching, any embedded references to other attributes, glossary terms or other Agility content is fully resolved. That means you cannot use free-text searching to look for reference tags.

Reserved characters

Some characters have a special meaning in Elasticsearch queries. These reserved characters should be escaped with a leading backslash character \

The reserved characters are: 
+ - = && | | > < ! ( ) { } [ ] ^ " ~ * ? : \ /

For example, to filter a facet for a value containing 1/2 you should set the term to 1\/2

warning

The < and > characters cannot be escaped.

Do not include them in a search term.

Syntax

This table lists the Elasticsearch Simple Query String Syntax supported in AMI. See Elasticsearch's own Simple Query String Syntax document (www.elastic.co) for more information.

Syntax

Description

Example
OR

|

By default multi-term searches are OR'd together.

Example: find matches that contain the word canadian OR the word bacon (in any order or position).

canadian bacon

canadian

OR

bacon

canadian

|

| bacon

AND

+

Use
the AND/&& keyword
+ if both terms are required (in any order or position).

canadian

AND

+ bacon

canadian && bacon

NOT
-

Use

the NOT/!/

- 

keywords

for words that must not be present.

canadian AND bacon NOT filmPreferred

Use the + operator to specify that a term must be present.

Example: the word bacon must be present, while the word canadian is optional (but will increase a result's relevance if it is present)

canadian +baconGroupingMultiple terms or clauses can be grouped together with parentheses, to form sub-queries.canadian AND (bacon OR ham)Wildcards

Wildcard searches can be run on individual terms, using ? to replace a single character, and to replace zero or more characters. 

Warning

Using the * wildcard at the beginning or end of a search term can use a lot of resources.

qu?ck bro*Regular Expressions

Regular expression patterns can be embedded in the query string by wrapping them in forward-slashes 

Warning

There is a performance overhead when using Regular Expressions.

/joh?n(ath[oa]n)/Fuzziness

Note that the example shows a search intended to find a value with both canadian and bacon and without film. If the + before -film was not there, because searches use OR by default, the search would actually match values that had either both canadian and bacon or didn't have film.

canadian + bacon + -film
~N
after a word

You can search for terms that are similar to, but not exactly like the search term using the “fuzzy” operator (~).

The default edit distance is 2 but you can add an integer after the ~ to specify a different value.

 

The edit distance is the number of insertions, deletions, substitutions or transpositions required to change one word into another. See Damerau–Levenshtein distance (Wikipedia) for more information.

quikc~ brwn~ foks~Boosting

quikc~1 brwn~1 foks~1
~N
after a phrase

You can

use the boost operator (^) to make one term more relevant than another. The default boost value for terms is 1: the positive number after the boost operator sets the relative relevance of the preceding term or grouping.quick^2 brown fox^0.5

set a slop amount for a phrase to indicate the number of words within it that may be different and still match.

The example would match  value of quick brown fox as only one word is different in the phrase. It would not match brown quick fox.

"quick red fox"~1
( )Use parentheses ( and ) to signify logical precedence.quick + (brown | red) + fox
*Use * to signify a prefix query.qu*