开发者

How do I do proximity search in Oracle right?

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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜