Operator: Contains (~)

Description

The contains operator allows you to see if a text field contains a piece of text.

The text can either be an unquoted single value, or a quoted value (in either double or single quotes) - normally you would use quotes around the string to make it clear you are searching for text.

The contains value supports the Lucene Query parser syntax as documented here

Text is indexed using the "Standard Analyzer" - this means that common words (stop words) such as "a", "the", "this" will not be indexed.

To return all values that don't contain some text, use the Does Not Contain (!~) Operator

Escaping

Examples

Name matching a single value:

Name ~ Test

Name matching either of the two words:

Name ~ "defect bug"

Name matching exactly:

Name ~ "'change password to invalid value'"

Name matching exactly, using string escaping via backslash:

Name ~ "\"Change password to invalid value\""

Name with single character wildcard (would match text, test etc):

Name ~ "te?t"  

Name matching a prefix (Lucene wildcard query):

Name ~ "log*"

Long-hand form of the "Contains" operator:

Name CONTAINS "log"

Notes

You can search across multiple text fields by using "OR":

Name ~ "test" OR Description ~ "test" OR PreCondition ~ "test" ...

But that's long winded - for this reason we also provide a special field "Text" which will automatically expand to search all fields that support the "Contains" operator (including custom fields).

Here is an example of it's usage to find any records where they contain the text "exception":

Text !~ "exception"

See the Text field for more details.

  • No labels