Knowledge Discovery 26.1
Knowledge Discovery Expert

# Query Syntax

This section describes the main query syntax that you can use for the Text part of queries.

For Boolean and proximity queries, you add operators to the text to specify the relationship that you want between the search terms. You can also use Brackets and other Special Characters in syntax.

## Boolean Operators

Operator | Description
--- | ---
AND | Both terms must occur.
NOT | The first term must occur, but not the second term.
OR | One of the terms must occur, but not necessarily both.
EOR or XOR | One of the terms must occur, but not both.

## Proximity Operators

Operator | Description
--- | ---
`NEARN` | The terms must occur within `N` words of each other.
`DNEARN` | The terms must occur within `N` words of each other, in the specified order.
`WNEARN` | One of the terms must occur, but not necessarily both, and extra relevance is given when the terms occur within `N` words of each other.
`YNEARN` | Both of the terms must occur, and extra relevance is given when the terms occur within `N` words of each other.
`BEFORE` | Both terms must occur, and the first term must occur earlier in the document than the second term.
`AFTER` | Both terms must occur, and the first term must occur later in the document than the second term.
`XNEARN` | The terms must occur exactly `N` words apart.
`SENTENCE` | The terms must occur in the same sentence.
`SENTENCEN` | The terms must occur in the same sentence, and within `N` words of each other.
`DSENTENCE` | The terms must occur in the same sentence in the specified order.
`DSENTENCEN` | The terms must occur in the same sentence in the specified order, and within `N` words of each other.
`PARAGRAPH` | The terms must occur in the same paragraph.
`PARAGRAPHN` | The terms must occur in the same paragraph, and within `N` words of each other.
`WHEN` | The first field and value must occur in the same XML segment as the second field and value.
`NOTWHEN` | The first field and value must occur, but the second field and value must not occur in the same XML segment.

NOTE: To use the `SENTENCE` and `PARAGRAPH` operators, you must have AdvancedPlus mode enabled.

## Brackets

You can use parentheses `()` to define the order in which to apply Boolean and proximity operators. The Content component applies the expression inside the brackets first, and then the expression outside the brackets. You can use this option to return a very specific set of results.

## Special Characters

The following characters have special syntactic meaning in the `Text` parameter of a query.

Syntax | Description | Example
--- | --- | ---
`Term:Field` | Field restriction. | `Text=cat:TITLE`
* | Wildcard character, which expands to any number of characters. | `Text=rollersk*`
? | Wildcard character, which expands to one character. | `Text=Mi?rotech`
`Term[NN]` | Apply a weight of `NN` to the specified `Term`. | `Text=cat[100]`
`Term[N:O]` | Apply an occurrence restriction to the specified `Term`. | `Text=cat[5:10]`
`"Terms"` | The exact phrase in quotations must occur. | `Text="phrase search"`
`~Term` | Case-sensitive search for `Term` (AdvancedCaseSearch only). | `Text=~iPhone`
`Term~` | Search for `Term` without stemming. | `Text=SHOP~`

## Ignore Special Characters

- Special characters. To prevent Content from interpreting the Special Characters in query Text with the meaning described in the table, set the query parameter `IgnoreSpecials` to `True`.

  Even with `IgnoreSpecials`, weights and stem indicators still have their syntactic meaning; for example, `CAT~[100]`. `IgnoreSpecials` also prevents Boolean operators from having their syntactic meaning.

- Wildcards. You can globally disable wildcards by using the `DisallowWildcards` configuration parameter.

- Weights. You can globally disable weights by using the `DisallowAgentWeights` configuration parameter.

## Other Operators

Operator | Description
--- | ---
`DREFUZZY(Term)` | Returns terms that have similar spelling to the specified `Term`.
`SOUNDEX(Term)` | Returns terms that are phonetically similar to the specified `Term`.

Related Topics

- Other Search Types

- FieldText Operators

Copyright 2025 Open Text
Version 26.1 | Last updated January 2026

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery 26.1

Topic Title: Query Syntax