PL-SQL中的contains()如何工作? [英] How does contains() in PL-SQL work?

查看:68
本文介绍了PL-SQL中的contains()如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的查询中使用contains()方法有很多不必要的结果.不要告诉我使用赞"之类的东西.它是硬编码的,不能更改.

Have a lot of unnecessary results using contains() method in my query. Don't tell me to use like or something else. It is hardcoded and couldn't be changed.

推荐答案

包含"用于具有上下文索引"的文本字段,该索引为要搜索的文本字段建立索引.标准用法是这样的(使用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%"

此处是另一个来源.

这篇关于PL-SQL中的contains()如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆