ContainsWord method: SearchFilterGenerator class

Syntax

ContainsWord(srch_field, word)

Description

Use the ContainsWord method to generate a string filter that matches strings containing the exact word or words. Words are separated by spaces and the logical and operator is implied; explicit logical operators are not supported between the words. This method forms the filter to find a match on all the words in the word parameter.

Note:

While the word parameter can include one or more words, this method differs from the ContainsPhrase method.

Parameters

Parameter Description

srch_field

Specifies the search field name as a string.

word

Specifies the exact word or words as a string.

Returns

None.

Example

Consider a document that includes the following sentence:

Apples are tastier than oranges.

The following use of ContainsWord will return a match.

&fg.ContainsWord("LONG_TEXT", "apples oranges");

However, the following use of ContainsPhrase will not return a match.

&fg.ContainsPhrase("LONG_TEXT", "apples oranges");