The interMedia Query Language

As we’ve learned, interMedia by default performs case-insensitive word matching, ignoring punctuation. So the CONTAINS query:

snow

matches all the following:

snow man
Snow Day
Let it snow!

A multiple-word query is treated as a phrase search. The words must come in the specified order, with no intervening words. For instance, the query:

snow tires

matches:

Snow tires are required.
Very deep snow -- tires require chains.

but not:

Bob quickly tires -- snow shoveling is hard work.  (incorrect order)
Snow man tires are the best you can buy!           (intervening words)

The query language also offers familiar Boolean operators. The query:

snow AND tires

finds any document with the word “snow” as well as the word “tires,” while:

snow OR tires

finds any document with the word “snow” or the word “tires,” or both. Parentheses can be used for grouping:

(rain OR snow) AND tires

Keep in mind that this whole expression is a single argument to the SQL CONTAINS function, so a real query would look like this:

SELECT claimid
  FROM claim
 WHERE CONTAINS(damagereport, '(rain OR now) AND tires') > 0

The WITHIN Operator

The syntax of the WITHIN operator is fairly simple:

                  text_subquery WITHIN elementname

text_subquery can involve words, phrases, Boolean operators—pretty much anything and everything we’ve seen so far. element can be any XML tag. Although XML tags and XPath queries are case-sensitive, the interMedia query language is not, so all case variations of the tag are matched. In most search applications, ...

Get Building Oracle XML Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.