Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server Sql Server可用于在关键字内搜索_Sql Server_Full Text Search_Full Text Indexing_Containstable - Fatal编程技术网

Sql server Sql Server可用于在关键字内搜索

Sql server Sql Server可用于在关键字内搜索,sql-server,full-text-search,full-text-indexing,containstable,Sql Server,Full Text Search,Full Text Indexing,Containstable,场景 我在一个名为标记的列中存储了一些关于每个产品的关键字。当用户搜索此列中存在的单词时,必须显示相关的产品。用户可能会在搜索查询中输入一些通用词(例如:an、or、some),因此我目前根据通用性为每个词分配了权重 使用 标签列是全文索引的,我使用Containstable搜索关键字 问题 几个月后,表的大小显著增加,我发现使用Containstable时出现了问题。当用户搜索某个单词时(该单词在相关行的“所有标记”列中出现的次数相同),结果行的排名不相等,且关键字计数较小(阈值较小)的每一行

场景
我在一个名为
标记的列中存储了一些关于每个产品的关键字。当用户搜索此列中存在的单词时,必须显示相关的产品。用户可能会在搜索查询中输入一些通用词(例如:an、or、some),因此我目前根据通用性为每个词分配了权重

使用
标签列是全文索引的,我使用
Containstable
搜索关键字

问题
几个月后,表的大小显著增加,我发现使用
Containstable
时出现了问题。当用户搜索某个单词时(该单词在相关行的“所有标记”列中出现的次数相同),结果行的排名不相等,且关键字计数较小(阈值较小)的每一行的排名较高

这不是问题,基于,
ContainsTable
使用
IndexedRowCount
KeyRowCount
进行排名

现在有并没有一种方法仅仅根据Tags列中出现的单词的加权和对每一行进行排序

更新
我需要像
包含
功能加重量这样的东西。
基于,
加权项
不影响
包含的

我的新代码没有
ContainsTable
,如下所示。这个代码非常慢

declare @q nvarchar(100)='word1#0.5,word2#0.4'
declare @wordsTable table(word nvarchar(30),weight decimal)

insert into @wordsTable
select substring(items,0,CHARINDEX('#',items)) as word,substring(items,CHARINDEX('#',items)+1,LEN(items)) as weight from split(@q,',')

declare @counter int
select @counter=COUNT(*) from @wordsTable
_____________________________________________
select Tags,SUM(rank) as ranks
from(
select (0.5) as rank, Tags from Product where contains(Tags,@word1)
    union 
select (0.4) as rank, Tags from Product where contains(Tags,@word2))
group by Tags