FORMS OF术语不搜索SQL Server的关键字

时间:2013-02-19 11:58:41

标签: sql sql-server sql-server-2008 sql-server-2008-r2

在我的专栏中,我有一个单词,但当我尝试将'and'搜索到FormOF时,它将无法搜索。

这是我的问题:

SELECT 
    DISTINCT 
    AttributeID, attribute_key, display_name, Segmentmaster.segmentname as SegmentName 
FROM 
    AttributeMaster 
LEFT JOIN
    Segmentmaster ON Segmentmaster.segmentID = AttributeMaster.segmentId 
WHERE
    CONTAINS(attribute_key, 'FORMSOF (INFLECTIONAL, "and")' ) 
    OR CONTAINS(display_name, 'FORMSOF (INFLECTIONAL, "and")' )  
ORDER BY  
    AttributeID ASC

FormsOf是否不搜索SQL Server的关键字和&,_,of ...等特殊字符

请指导我..

1 个答案:

答案 0 :(得分:0)

我认为'and'位于STOPLIST。你需要检查一下

SELECT stopword
FROM sys.fulltext_indexes i JOIN sys.fulltext_stoplists l ON i.stoplist_id = l.stoplist_id 
                            JOIN sys.fulltext_stopwords w ON l.stoplist_id = w.stoplist_id
WHERE i.object_id = OBJECT_ID('AttributeMaster') AND stopword LIKE 'and'

_test和索尼的话全文发现没问题,但遗憾的是&,_字符符号不起作用。可以尝试使用这个:

SELECT DISTINCT AttributeID, attribute_key, 
                display_name, Segmentmaster.segmentname as SegmentName 
FROM AttributeMaster LEFT JOIN Segmentmaster ON Segmentmaster.segmentID = AttributeMaster.segmentId 
WHERE CONTAINS(attribute_key, 'FORMSOF (INFLECTIONAL, "_test")' ) 
  OR CONTAINS(display_name, 'FORMSOF (INFLECTIONAL, "_test")' )
  OR attribute_key LIKE '&'
  OR display_name LIKE '&'
ORDER BY AttributeID ASC