Full-text search not finding results by removing characters at the font of the string

泪湿孤枕 提交于 2020-01-17 09:11:14

问题


I have an full-text catalog on my table when I remove the first couple of characters of the search string it can't find my products anymore but when I remove the last couple it finds the right products.

When I found out I tested the behavior on a other site/server, and there it is fully working, doesn't matter if I remove some characters at the front or back it still finds my products.

Working:

SELECT ProductId FROM Product WHERE CONTAINS((FreeTextSearchString),'"*ij2001AR*"')
SELECT ProductId FROM Product WHERE CONTAINS((FreeTextSearchString),'"*ij2001*"')

Not working:

SELECT ProductId FROM Product WHERE CONTAINS((FreeTextSearchString),'"*2001AR*"')

Why is it behaving like that? And what can I do to fix it?


回答1:


as per my observation on Query 7 (CONTAINS)

SELECT * FROM content WHERE contains(Description,'  "*azine"  ')

You can't use an asterisk as a placeholder for a prefix.




回答2:


Looking at msdn for the CONTAINS Syntax it seems you should be passing the column where you are searching as the first argument:

DECLARE @SearchWord varchar(30)
SET @SearchWord ='performance'
SELECT Description 
FROM Production.ProductDescription 
WHERE CONTAINS(Description, @SearchWord);

In the example above if you were filtering the field Description for 'perf' without the * it should return the row with 'performance' on the field description, right?

Link to the msdn reference: msdn



来源:https://stackoverflow.com/questions/27618652/full-text-search-not-finding-results-by-removing-characters-at-the-font-of-the-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!