SQL Server ContainsTable not returning result with term “inn”

随声附和 提交于 2019-12-05 18:25:13

This is my theory..

Your hotel name, Inn on the Park, would be index like this:

pos   word
1     Inn
2     (noise)
3     (noise)
4     Park

on and the are stop/noise words, and not stored in the index (but notice that the position is still stored).

You're searching by a full string. Taking in to account the noise words this would mean:

Query 1: "Inn on Park" -> "Inn (noise) Park"
Query 2: "In on Park" -> "(noise) (noise) Park"

Your indexed string (hotel name) is Inn (noise) (noise) Park, so this would be a partial match on the second query, but no match on the first.

This can be tested by for example searching for Inn 1 1 Park. This will return a result. But Inn 1 Park or 1 Inn 1 Park will not (positions does not correspond).

To "fix" this you could use different operators, like AND, OR or NEAR:

"Inn" AND "Park"
"Inn*"
"Inn" NEAR "Park" 

Here are two screenshots, showing the results of your main queries. Notice how the second will only search for "Park", or "noise noise Park" (any of those would return results):

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