How do I do proximity search in Oracle right?
Posted
by hko19
on Stack Overflow
See other posts from Stack Overflow
or by hko19
Published on 2010-06-16T23:40:13Z
Indexed on
2010/06/16
23:42 UTC
Read the original article
Hit count: 217
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?
© Stack Overflow or respective owner