Search argument syntax

You can specify a search argument as the condition of a search for terms in text documents. It consists of search parameters and one or more search terms. The SQL scalar text search functions that use search arguments are CONTAINS and SCORE.

For any language-specific processing during a search, you can specify a value for the QUERYLANGUAGE parameter as a search argument option. The value can be any of the supported language codes.

If the QUERYLANGUAGE parameter is not specified, the default value is the language value of the text search index used when this function is called.

If the language value of the text search index is AUTO, the default value for QUERYLANGUAGE is en_US.

Limitations

You cannot use the CONTAINS and SCORE functions in an SQL constraint or index definition. You can use them in SQL query statements and view definitions under the following restrictions:
  • If a view, nested table expression, or common table expression provides a text search column for a CONTAINS or SCORE scalar function, and if the applicable view, nested table expression, or common table expression has a DISTINCT clause on the outermost SELECT statement, then the SELECT list must contain all the corresponding key fields of the text search index. Otherwise, SQL message 38H12 is returned.
  • If a view, nested table expression, or common table expression provides a text search column for a CONTAINS or SCORE scalar function, then the applicable view, nested table expression, or common table expression cannot have a UNION, an EXCEPT, or an INTERSECT statement at the outermost SELECT level. Otherwise, SQL message 38H12 is returned.
  • If a common table expression provides a text search column for a CONTAINS or SCORE scalar function, the common table expression can be referenced again in the entire query only when the reference does not provide a text search column for a CONTAINS or SCORE scalar function. Otherwise, SQL message 38H12 is returned.
  • A function cannot be created sourced on the CONTAINS or SCORE scalar functions. Otherwise, SQL message SQL0457 is returned.
  • The query can run through the SQL Query Engine (SQE).

Simple search

To do a simple keyword search, enter one or more keywords in the query. The search engine returns documents that contain all those keywords, or variations of the keywords.

For example, if you enter king, the search engine returns all documents that contain the word king or kings. If you enter the query king lear, the search engine returns documents that contain the terms king and lear.

To see more precise results, use more specific keywords. For example, use French roast coffee rather than coffee, or use Kauai hiking tours rather than Hawaiian vacations.

If a simple keyword search returns too many documents that are not what you are looking for, you can use operators to refine your search.

Exclusion of terms in a search

Use the minus sign (-) to exclude terms. For example, if you want to find documents with the term lear, and not edward, enter the query lear -edward.

The minus sign (-) also applies to a term and its variants. For example, the query -edward excludes documents that contain the word edward's.

Phrase search

If you want to ensure that terms are displayed exactly in the sequence that you typed them in, you can use double quotation marks. For example, if you want to see documents with the term king lear exactly, and not related phrases such as kingly lear or king and queen lear, enter "king lear". The search is not case-sensitive, but term variants are not considered matches.

Language processing

OmniFind Text Search performs language-specific processing on terms by using the language that is specified by the query. When the language is not specified, the default language is used.

When you search for a word, the base form of the word is also searched. For example, searching for tests or testing also finds the word test.

During language processing, predefined synonyms are added to the query. Language processing is not performed on phrases and on terms in all capital letters, for example, DOG.

Wildcard character in a search

The wildcard character (*) helps you find documents when you do not know the full spelling, or if you want to find variations of the term. For example, the query czech* returns documents with the terms czech, czechoslovakia, czechoslovakian, czech republic, and other possible results.

You can also use the wildcard character in a phrase search. For example, the query "John * Kennedy" returns documents with the terms John Fitzgerald Kennedy and John F Kennedy but not John Kennedy. The query Mi*l Gorbachev returns Mikhail Gorbachev.

Adding a wildcard character to the beginning of a query (for example, *zech) might cause the search engine to take longer to return results.

Searches for at least one of the terms

The logical operator OR specifies that at least one of the terms in a query must be displayed in the returned document. For example, the query (othello OR otello) returns documents that contain the term othell or otello.

You can also use the logical operators AND, OR, and NOT in combinations by using parentheses. For example, the query cougar OR (jaguar AND NOT car) returns documents with the terms cougar or jaguar but not car.

You must enter the logical operators AND, OR, and NOT in all uppercase. Use parentheses for grouping.