Oracle Full Text 如何搜索相似词
Oracle Full Text how to search similar words
首先,我是 Oracle Text 的新手,所以请多多包涵。
我认为我的情况很容易管理,因为我必须在相同 table 的两个字段上进行搜索,而且这些字段非常小。
看了一些文章,我觉得CTXCAT索引对我来说已经足够了,但是我不明白如何搜索部分词;例如,如果我搜索 'peak',我也希望返回 'speak' 之类的词。你能帮我理解一下吗?
请访问下面link:
http://www.oracle.com/technetwork/testcontent/ctxcat-primer-090555.html
上面提到的 link 的部分内容如下。
我想找到所有包含单词 "toy" 和 "dog" 但不包含短语 "live animal":
的拍卖品
SELECT item_id, item_desc
FROM auction WHERE CATSEARCH (item_desc, '(toy dog) | "live animal"', null) > 0;
注意几点:
- ANDed terms do not need the word AND or even an "&" operator. AND is
assumed between any adjacent terms.
- NOT is represented by "|" (OR, not
used here, is represented by "|").
- Parentheses can be used to group
terms.
- Double quotes are used to surround a phrase (otherwise "live
animal" would have been read as "live AND animal".
上面查询中的"null"是结构化子句的占位符。没有默认值 - 如果您不提供任何结构化子句,则必须在此处放置 "null"。
结构化子句允许您限制或排序您的结果。如果我想扩展上面的查询以仅查找价格低于 100 美元的商品,我可以使用
WHERE CATSEARCH (item_desc, '(toy dog) | "live animal"', 'price < 100') > 0
如果我想首先获得最新项目的结果,我可以使用
WHERE CATSEARCH (item_desc, '(toy dog) | "live animal"',
'price < 100 order by start_time desc') > 0
首先,我是 Oracle Text 的新手,所以请多多包涵。 我认为我的情况很容易管理,因为我必须在相同 table 的两个字段上进行搜索,而且这些字段非常小。 看了一些文章,我觉得CTXCAT索引对我来说已经足够了,但是我不明白如何搜索部分词;例如,如果我搜索 'peak',我也希望返回 'speak' 之类的词。你能帮我理解一下吗?
请访问下面link:
http://www.oracle.com/technetwork/testcontent/ctxcat-primer-090555.html
上面提到的 link 的部分内容如下。
我想找到所有包含单词 "toy" 和 "dog" 但不包含短语 "live animal":
的拍卖品SELECT item_id, item_desc
FROM auction WHERE CATSEARCH (item_desc, '(toy dog) | "live animal"', null) > 0;
注意几点:
- ANDed terms do not need the word AND or even an "&" operator. AND is assumed between any adjacent terms.
- NOT is represented by "|" (OR, not used here, is represented by "|").
- Parentheses can be used to group terms.
- Double quotes are used to surround a phrase (otherwise "live animal" would have been read as "live AND animal".
上面查询中的"null"是结构化子句的占位符。没有默认值 - 如果您不提供任何结构化子句,则必须在此处放置 "null"。 结构化子句允许您限制或排序您的结果。如果我想扩展上面的查询以仅查找价格低于 100 美元的商品,我可以使用
WHERE CATSEARCH (item_desc, '(toy dog) | "live animal"', 'price < 100') > 0
如果我想首先获得最新项目的结果,我可以使用
WHERE CATSEARCH (item_desc, '(toy dog) | "live animal"',
'price < 100 order by start_time desc') > 0