I'm trying to implement a Full Text Search. I'm using FREETEXT and I get the correct results. The problem is the ordering of results. If try to search for "car park" the results that match both those words should be at the beginning and then those matching only one of them. How can I accomplish this?
Thank
Use FREETEXTTABLE instead of FREETEXT.
FREETEXTTABLE will return a table of keys with Rank information. You can sort on this Rank information to find the items that are the closest matches.
Microsoft FREETEXTTABLE documentation
The following example shows how this works:
SELECT
t.TableID
, t.TextData
, ft.Rank
FROM
Table t
INNER JOIN FREETEXTTABLE ( Table , * , 'car park' ) ft ON ( t.TableID = ft.[Key] )
ORDER BY
ft.Rank DESC
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With