> Make sure you use a sufficient amount of representative data to verify the
> result. Perhaps you could also share your final solution with us...?
Sure I'll share!
The following works great, but I still don't know if it's the best way to do
it or not:
SELECT p.pname, p.p_id, m.mname, k.rank from products p
INNER JOIN manufacturers m ON p.mid = m.mid
INNER JOIN (SELECT Rank, [KEY]
FROM FREETEXTTABLE(products,*, 'giant')) AS k
ON k.[key]=p.p_id
UNION SELECT p.pname, p.p_id, m.mname, k.rank from products p
INNER JOIN manufacturers m ON p.mid = m.mid
INNER JOIN (SELECT Rank, [KEY]
FROM FREETEXTTABLE(manufacturers,*, 'giant')) AS k
ON k.[key]=m.m_id
ORDER BY Rank DESC
I actually stepped this out to a third table in the full-text cat with a
second UNION SELECT, and it worked perfectly.
HTH!
Simon Sabin - 27 Jan 2007 21:02 GMT
Hello geek-y-guy,
You need to decide how you want to rank the data.
Does a match in products beat a match in manufacturers,
Does a poor match in both products and manufacturers beat a good match in
products.
Essentially the 2 ranks you get back are not related i.e. a rank of 80 for
the products frretext will not mean the same as a rank of 80 in the manfucaturers
freetext.
Your code may give duplicates, the best option is to either add the 2 ranks
(sort of even weighting) or mulitply one by a factor i.e. 100 and then add
them, This weights a mathc in the owe table before the other.
We do exactly that, if a search for a job is matched in the job title it
gets ranked above one that matches in the job description.
So look at ML's second post and then do what you will with the ranks
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
>> Make sure you use a sufficient amount of representative data to
>> verify the result. Perhaps you could also share your final solution
[quoted text clipped - 20 lines]
>
> HTH!