views:

50

answers:

1

Oracle's NEAR operator for full text search returns a score based on the proximity of two or more query terms. For example:

near((dog, bite), 6)

matches if 'dog' and 'bite' occurs within 6 words. What if I'd like it to match if either 'dog' or 'cat' or any other type of animal occurs within 6 words of the word 'bite'? I tried:

near(((dog OR cat OR animal), bite), 6)

but I got:

NEAR operand not a phrase, equivalence or another NEAR expression

Rather than expanding all possible combination into multiple NEAR and 'or' them together, what is the proper way to write such query?

+1  A: 

Looks like the EQUIV operator should do it. Doc Ref.

You can also use the equivalence operator to substitute a single term in a near query:

'near((stock crash, Japan=Korea), 20)'

This query asks for all documents that contain the phrase stock crash within twenty words of Japan or Korea.

Gary
Thanks, and it seems the equivalence operator even work on more than 2 terms:'near((stock crash, Japan=Korea=China),20)'But, how would you 'near' a word with another 'near' clause?
hko19