且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PL-SQL中的contains()如何工作?

更新时间:2022-06-11 21:34:10

包含"用于具有上下文索引"的文本字段,该索引为要搜索的文本字段建立索引.标准用法是这样的(使用score运算符根据contains中的1与score中的1匹配,显示contains子句返回的内容):

Contains is used on text fields that have a 'CONTEXT Index', which indexes a text field for searching. The standard usage is like this (using the score operator to display what is returned from the contains clause based on the 1 in contains matching the 1 in score):

SELECT score(1), value
FROM table_name
WHERE CONTAINS(textField, 'searchString', 1) > 0;

对于表table_name

value  |  textField
-------|-----------------------------------------------
A      |   'Here is searchString.  searchString again.'
B      |   'Another string'
C      |   'Just one searchString'

该查询将返回

2 A
1 C

因此包含类似,但将计算文本字段中字符串出现的次数.我找不到包含包含在您发布的查询中使用的资源的资源,但是我认为这将返回其中dFullText至少具有一个car实例的行,或者等效于此sql:

So contains is similiar to like, but will count how many times a string occurs in a text field. I couldn't find a resource using Contains the way it is used in the query you posted, but I think that would return rows where dFullText has at least one instance of car in it, or the equivalent of this sql:

Select * from blabla where dFullText like "%car%"

此处是另一个来源.