1

在我的专栏中,我有单词,但是当我尝试搜索它'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 ...

请指导我..

4

1 回答 1

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和sony的话全文查找没问题,可惜对于&、_字符符号不起作用。有可能可以试试这个:

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
于 2013-02-19T14:17:29.857 回答