全文搜索条件'of'附近的语法错误'control of' [英] Syntax error near 'of' in the full-text search condition 'control of'

查看:184
本文介绍了全文搜索条件'of'附近的语法错误'control of'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  WHERE(@关键字IS NULL 
OR(CONTAINS((p.Title,p.Area,p。[Message]),@Keywords))

如果 @Keywords ='control',那么查询将成功执行并过滤我的记录



如果 @Keywords ='控制',那么我得到以下错误:


全文搜索条件'control'中'of'附近的语法错误。

为什么是这样的,我能做些什么来解决这个问题?



我使用这个方法的主要原因是使用 LIKE

code> condition使我可以搜索多个单词。

解决方案

如果您想要使用双引号将关键字括起来准确搜索控制

  SET @Keywords ='控制'

如果您要搜索控制 ,请使用以下内容:

  SET @Keywords ='control AND of'



<但是,服务器可能会将 视为垃圾或停用词,因此在这种情况下请使用以下内容:

<$ '


的SET @Keywords ='control AND'

I have the following WHERE clause:

WHERE (@Keywords IS NULL
            OR (CONTAINS((p.Title, p.Area, p.[Message]), @Keywords))
        )

If @Keywords = 'control', then the query executes successfully and filters my records

If @Keywords = 'control of', then I get the following error:

Syntax error near 'of' in the full-text search condition 'control of'.

Why is this and what can I do to resolve the issue?

The main reason I'm using this method over using LIKE condition is so that I can search multiple words.

解决方案

Enclose the keywords in double quotes if you want to search exactly for control of

SET @Keywords = '"control of"'

If you want to search for control and of, use the following:

SET @Keywords = 'control AND of'

But server may consider of as a garbage or stop word, so in this case use the following:

SET @Keywords = 'control AND "of"'

这篇关于全文搜索条件'of'附近的语法错误'control of'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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