Giving precedence/weight to a column using FREETEXTTABLE

前端 未结 1 943
孤独总比滥情好
孤独总比滥情好 2020-12-16 00:52

I am using SQL Server Full Text Search, with the keyword FREETEXTTABLE to return a table of results based on a few columns, searching for a keyword.

Now I have 2 mai

1条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 01:23

    You'll need to use 2 queries with a union, providing a 'weight' of your own, something like this:

    select  [key], sum(rnk) as weightRank
    from
            (
                select Rank * 2.0 as rnk, [key] from freetexttable(tableName,Title,'free text string')
                union all
                select Rank * 1.0 as rnk, [key] from freetexttable(tableName,Description,'free text string')
            ) as t
    group by [key]
    

    0 讨论(0)
提交回复
热议问题