select count(*) from MyTable where FREETEXT(LongDescription,'BOTH') --Returns 0
select count(*) from MyTable where FREETEXT(LongDescription,'"*`BOTH`*"') --Returns 0
select count(*) from MyTable where Contains(LongDescription,'BOTH') --Returns 0
select count(*) from MyTable where Contains(LongDescription,'"*`BOTH`*"') -- Returns 5
select count(*) from MyTable where LongDescription like '%BOTH%' -- Returns 7040
select count(*) from MyTable where LongDescription like '%XXS%' -- Returns 2473
select count(*) from MyTable where FREETEXT(LongDescription,'"*XXS*"') -- Returns 2787
select count(*) from MyTable where contains(LongDescription,'"*XXS*"') -- Returns 2411
我尝试了带有和不带有`以及“,*,%”的变体。由于BOTH是保留字,是否会阻止Contains或Freetext正常工作?我可以搜索其他单词,但即使如此我得到随机结果。
sys.fulltext_stopwords和sys.fulltext_stoplists为空。
我正在尝试模仿https://datatables.net/之类的搜索功能,在该功能中,搜索方式是以行分隔的每个字符串都存在于该行的至少1列中。我知道我可以这样做,但是如果他们都输入像BOTH这样的单词,那么它以某种方式返回0,是否值得使用?否则,我将创建一个查询构建器来创建类似这样的东西。
select count(*) from MyTable
where
(SearchDescription like '%TEST%' or
ShortDescription like '%TEST%' or
LongDescription like '%TEST%')
and
(SearchDescription like '%BOTH%' or
ShortDescription like '%BOTH%' or
LongDescription like '%BOTH%')
and
(SearchDescription like '%THREA%' or
ShortDescription like '%THREA%' or
LongDescription like '%THREA%')