How do I do proximity search in Oracle right?
- by hko19
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?