contains
New in Domino 11: In addition to using NSF scanning and
view indexes, DQL provides the contains
operator to process queries against full
text indexes. A database must have a full text index to be processed in this way.
Use contains
to search for text strings in a specific field or across all fields
in a document.
The following two examples search for text strings in specific
fields:
Sales_person contains (‘Trudi’, ‘Jack*’)
Order_description contains all (‘diagonal’, ‘brushed nickel’, ‘cap*’)
The following two examples omit field names and search for text strings across all text fields in
a
document:
contains ('Mercury', 'spinning wildly', 'orbit*')
contains all ('Tiger Lily', 'Pete*', 'Lost boy?')
all Use all
to find only documents that contain all of
the specified strings. Omit all
to find documents with any of the specified
strings.
wildcards Use the *
(asterisk) wildcard to match multiple
characters. Use the ?
(question mark) wildcard to match a single character.
Wildcards must be part of a string that contains non-wildcard characters. Freestanding wildcards
aren't supported. For example, the following queries are valid use of
wildcards:
short_description contains (‘??????hold*’)
finds
threshold
and thresholding
.short_description contains (‘hold?n*’)
finds each of the following:
holding
, holdon
, or holden
.However, the following queries have freestanding wildcards and return
nothing:
short_description contains (‘*’)
short_description contains (‘hold *’)
blank spaces Blank spaces in query terms are ignored. For example, the
following queries return the same results:
short_description contains ('hold')
short_description contains (' hold ')
Additional information
- It finds text values only. Numbers and timedates are not searchable.
- It is often the fastest method of searching document contents.
- It requires a full text index. Queries fail to compile if a database does not have a full text index.
contains
and=
are not equivalent:contains
searches for a text string while=
searches for the entire content of a field. For example, if a document includes the field sales_person with value ‘Trudi Ayton’, only the first of the following two queries finds it:sales_person contains (‘Trudi’) sales_person = ‘Trudi’