About this task
You can combine search terms with other search terms using
the Boolean operators “&” (AND) and “|” (OR):
SELECT AUTHOR, TITLE
FROM DB2EXT.TEXTTAB
WHERE CONTAINS(COMMENT,
'"author" | "pulitzer"') = 1
You
can also combine several terms by using Boolean operators:
SELECT AUTHOR, TITLE
FROM DB2EXT.TEXTTAB
WHERE CONTAINS(COMMENT,
'"author" | "pulitzer" & "book"') = 1
If
you use more than one Boolean operator, these are evaluated from left
to right. However, as in regular Boolean logic, the logical AND operator
(&) binds stronger than the logical OR operator (|). You can see
this evaluation in the following example, which does not include parentheses:
"book" & "pulitzer"| "year" & "author"
Net
Search Extender evaluates the boolean operators in the following way:
("book" & "pulitzer") | ("year" & "author")
If
you want to enforce a different evaluation order of the boolean operators,
you must include parentheses:
"book" & ("pulitzer" | "year") & "author"
You
can also combine Boolean operators with search terms that are chained
together using the comma separator:
("author", "pulitzer") & "book"
In
this case, the comma is interpreted as a Boolean OR operator:
("author"| "pulitzer") & "book"