The wildcard operator allows you to substitute wildcard characters for part of the item for which you are searching. Table 5-5 describes the wildcard characters and their attributes.
Character |
Function |
Syntax |
Locates |
---|---|---|---|
? |
Specifies one alphanumeric character. You do not need to include the wildcard operator when you include the question mark in your query. The question mark is ignored in a set ([]) or in an alternative pattern ({}). |
’?an’ |
“ran,” “pan,” “can,” and “ban” |
* |
Specifies zero or more of any alphanumeric character. You do not need to include the wildcard operator when you include the asterisk in your query; you should not use the asterisk to specify the first character of a wildcard-character string. The asterisk is ignored in a set ([]) or in an alternative pattern ({}). |
’corp*’ |
“corporate,” “corporation,” “corporal,” and “corpulent” |
[] |
Specifies any single character in a set. If a word includes a set, you must enclose the word in backquotes (‘‘). Also, there can be no spaces in a set. |
<wildcard> ‘c[auo]t‘ |
“cat,” “cut,” and “cot” |
{} |
Specifies one of each pattern separated by a comma. If a word includes a pattern, you must enclose the word in backquotes (‘‘). Also, there can be no spaces in a set. |
<wildcard> ‘bank{s,er,ing}‘ |
“banks,” “banker,” and “banking” |
^ |
Specifies one of any character not included in a set. The caret (^) must be the first character after the left bracket ([) that introduces a set. |
<wildcard> ‘st[^oa]ck‘ |
Excludes “stock” and “stack,” but locates “stick” and “stuck” |
- |
Specifies a range of characters in a set. |
<wildcard> ‘c[a-r]t‘ |
Includes every three-letter word from “cat” to “crt” |
To relevance-rank the result set, include the many modifier in the query. See “Operator modifiers”.
For example, the following query searches for documents that include variations of the word “slingshot:”
select t2.copy from i_blurbs t1, blurbs t2 where t1.id=t2.id and t1.index_any = ’"slingshot*"’
score copy ----- ----------------------------------------------------------- 100 Albert Ringer was born in a trunk to circus parents, but another kind of circus trunk played a more important role . . . gorilla. "Slingshotting" himself from the ring ropes, . . .