Full Text Searching with Oracle Reference Table

Listed below is the syntax table used for full-text searching with an Oracle database. All searching is case insensitive. Additionally, all single letters and numbers, as well as “noise” words such as “well,” “or,” “and,” “etc.”, are automatically excluded from searches. Configuration of the Oracle database is required to change these settings.

Type of Search

Examples

Simple words

photos

Phrase search

“Zasio Enterprises”

The same as a phrase search, “dog cat”.

dog cat

AND, &

All words in search must be present to match.

photos AND digital

photos & digital

OR, |

Any word in search can be present to match.

photos OR photography

photos | photography

NOT, ~

All entries with the word “photos” but not the word “digital” will be found.

photos NOT digital

photos ~ digital

Returns all “photo”, “photos”, “photography”, etc.

Returns all “photos”, “photod” but not “photo” or “photography”.

Use wildcard characters in query expressions to expand word searches into pattern searches. The percent (%) wildcard specifies that any characters can appear in multiple positions represented by the wildcard. The underscore (_) wildcard specifies a single position in which any character can occur.

photo%

photo_

Stem searching, for example, $sing returns sing, sang, and sung.

$sing

Fuzzy matching, for example, ?dog returns dog, doug, and dojo.

?dog

Use the NEAR operator to return results based on the proximity of two or more query terms. For near queries with two terms, the number is the maximum distance allowed between the two terms. For example, use this query on dog and cat to find entries where dog is within 6 words of cat. The maximum number is 100.  Specify TRUE for Oracle to search for terms in the order you specify. The default is FALSE.  Searching for “dog NEAR cat” uses all the defaults and would be equivalent to saying “NEAR((dog,cat),100,FALSE)”.

NEAR ((dog, cat), 6, TRUE)

dog NEAR cat

Sounds-like searching, for example, !here returns here, hear, and hair.

!here

Equivalence searching. This example will match the phrases "dogs are pets" and "cats are pets".

dogs=cats are pets

Combinations

“Idaho Photography” AND digital

photo% NOT digital

Returns “O'Conner” – must use two single quotes together when searching using a single quote character.

O’’Conner or

“O Conner”

Grouped by ()

digital AND (photo% OR pict%)

Returns “123 45 6789”, “123-45-6789”, “123!45_6789”, etc.

Returns “123-45”, “123 45-678”, “123_456”, etc.

Searching for text with punctuation is best done by replacing the special characters with spaces. Punctuation is not indexed and can cause unexpected results if improperly used in a search.

“123 45 6789”

“123 45%”

Returns “123 45 6789” and “123-45-6789”

Returns “123 45” and “123-45”

Escapes special characters and treats them as normal characters.

{123-45-6789}

123\-45

Any search that involves punctuation or other special characters may return unexpected results if the special characters are not escaped with a forward slash or curly braces as in the previous phone number example.  The comma, for example, has special meaning in numeric contexts, so “12,345” is different from “ab,cde”.  Ideally, all searches involving special characters should be done by replacing a space or a wild card for these characters; for example, “123 455 7890”.

Searches involving punctuation

Related Topics