Priority / weight per column using FREETEXTTABLE in dymnamic TSQL

I have a dynamic sql that does paging and full-text search using CONTAINSTABLE, which works fine. The problem is that I would like to use FREETEXTTABLE, but the rank weight of some colums over others

Here is my original sql and ranking weight that I would like to integrate (I changed the names for privacy)

SELECT * FROM 
    (SELECT TOP 10 Things.ID, ROW_NUMBER() 
        OVER(ORDER BY KEY_TBL.RANK DESC ) AS Row FROM [Things]
    INNER JOIN 
        CONTAINSTABLE([Things],(Features,Description,Address),
            'ISABOUT("cow" weight (.9), "cow" weight(.1))') AS KEY_TBL 
    ON [Properties].ID = KEY_TBL.[KEY] 
    WHERE TypeID IN (91, 48, 49, 50, 51, 52, 53) 
        AND
        dbo.FN_CalcDistanceBetweenLocations(51.89249, -8.493376, 
        Latitude, Longitude) <= 2.5 
    ORDER BY KEY_TBL.RANK DESC ) x 
WHERE x.Row BETWEEN 1 AND 10

Here is what I would like to integrate

select sum(rnk) as weightRankfrom
From
(select 
    Rank * 2.0 as rnk, 
    [key] 
from freetexttable(Things,Address,'cow')
union all 
select 
    Rank * 1.0 as rnk, 
    [key] 
from freetexttable(Things,(Description,Features),'cow')) as t 
group by [key] 
order by weightRankfrom desc 
+3
source share
2 answers

, , freetext (FREETEXTTABLE), . , freetext.

0

:

  • Less_important_field &
  • More_important_field More_important_field (2x)

, , BM25F . , . , , .

0

Source: https://habr.com/ru/post/1724616/


All Articles