Oracle ATG Web Commerce Search handles natural language and Boolean queries. Simple Boolean syntax is handled automatically as part of the natural language processing, but complex Boolean expressions require a special mode of processing. Furthermore, Search can support simple keyword search behavior in several additional modes. These modes are controlled by this attribute:
<query mode="mode
"
The mode
value can be any one of the following:
nlp
—Natural-language and simple Boolean queries. This is the default value, but should not be used for Oracle ATG Web Commerce installations.boolean
—Deprecated.booleanDoc
—This mode performs a Boolean match at the document level. See below for details on Boolean expressions.booleanStmt
—Complex Boolean expressions; see below for details. This mode operates at the statement level, and should therefore not be used for Oracle ATG Web Commerce integrations; for example, “red” and “shoes” would be indexed as separate statements, and a search that includes both would return no results. See below for details on Boolean expressions.keyword
—Handles natural language queries in a simplistic keyword search model. Oracle ATG Web Commerce Search parses the query as normal, but each query term is double-quoted and required to appear in the index items of the results. For example, a query of install procedures inkeyword
mode would be interpreted as ++”install” ++”procedures”.and
—Handles natural language queries in an expanded keyword search model. Search parses the query as normal, but each query term is required to appear in the index items of the results. This is similar to thekeyword
mode, but without the double-quotes, which means the query terms could match morphological variants and use term expansions. For example, a query of install procedures inand
mode would be interpreted as ++install ++procedures.This mode is strongly recommended for use with Commerce.
matchall
—Natural language queries as a Boolean AND of terms, as opposed to the default Boolean OR. Search parses the query as normal, but each query term is required to appear in the result statements. For example, a query of install procedures inkeyword
mode would be interpreted as +install +procedures.
As described in the User-Entered Operators chapter, the required term and excluded term operators represent simple approximations of true Boolean operators, and can be entered as part of the query, with no special user interface. In addition to these simple operators, Search supports a special query syntax for Boolean expressions which are parsed in a special mode of query handling. The Boolean syntax is shown here in Backus Naur Form:
expr := <expr> AND <expr>
expr := <expr> OR <expr>
expr := NOT <expr>
expr := ( <expr> )
expr := [']["]term
["][']
expr := [']wildcard
[']
expr := i..j
The first three statements show the syntax for the three Boolean operator expressions, whose operands can themselves be other expressions. The precedence for these operators is: NOT, AND, OR. The fourth statement shows that parentheses can be used to delimit an expression in order to override operator precedence. For example, x AND y OR z is interpreted by default as (x AND y) OR z, but using explicit parentheses, it could be interpreted as x AND (y OR z).
The last three statements show the three types of simple term expressions: normal term, with optional quote operators; wildcard pattern, with optional single quote operator; and a number range pattern. Thus, full Boolean expressions can utilize all the simple query operators described in this section except for the simple Boolean operators (+, !, ++, !!, +|).
Oracle ATG Web Commerce Search handles full Boolean expressions specially, but it shares much of the natural language query handling. Search parses the Boolean expression, building up an operator-operand tree. During this parsing, it processes the terms in the same way as a natural language query, including tokenization, morphology and term expansion. In addition, it also has to process the special query operators that may modify the terms. At the end of this process, Search has a vector of query items that can execute normally, plus a Boolean expression tree that can filter the retrieved sentence results.