all groups > sql server full text search > september 2004 >
You're in the

sql server full text search

group:

Scaling Rank


Scaling Rank Nargis
9/14/2004 10:13:07 PM
sql server full text search:
Hello,
i m using full text search .. but the problem is i want to present the
result with very few results with the rank ... the rank as generated by the
sql full text is only usefull when compared with the other ranks .. i want to
scale it from 1 to 100.. any ideas on how to do this ...
Re: Scaling Rank John Kane
9/14/2004 11:05:51 PM
Nargis,
I'm not exactly sure what you're trying to achieve. Could you provide a more
specific example? If you had a FTS query that returns 100 rows, would you
want the rank for each row to be 1 - 100? If not, how would you group the
ranking results on a per query basis? You should also review the paragraph
in the SQL Server 2000 BOL title "Full-Text Search Recommendations" that
starts with "What is RANK and how is it determined when used with
CONTAINSTABLE and FREETEXTTABLE predicates? "

More detailed info is always helpful in understanding your question/request
so we can better answer your question/request.
Thanks,
John


[quoted text, click to view]

Re: Scaling Rank Hilary Cotter
9/15/2004 7:35:16 AM
I'd try something like this:

declare @max int
select @max= max(rank) from text join containstable(texttable,
textcol,'Microsoft',1) as search on search.[key]=text.pk
select (rank*100/@max) from text join containstable(texttable,
textcol,'Microsoft',100) as search on search.[key]=text.pk order by rank
desc

This will involve two hits on your SQL FTS catalog.

--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html


[quoted text, click to view]

Re: Scaling Rank Nargis
9/16/2004 9:29:09 PM
John
Wat i basically want is that the if my query returns 100 records all should
be ranked from 1- 100 , i want to make sure that rank would always be 1-100..
and at the same time i want to be able to rank the results of differnt
queries ....so max thing will not work with me
if the max rank for one query is 40 and if a record has a rank = 39
and another query returns max rank 144 and one record has rank 60

if i use max method .. it rank for 39 would be greater than the rank for 60
.....
Is not there any other way to restrict sql server to never generate ranks
beyond 100....
or any other work around for it ...??

[quoted text, click to view]
Re: Scaling Rank Hilary Cotter
9/17/2004 8:26:41 AM
Can you try the query I supplied again. It does the ordering and the
normilization you are looking for.

make sure you don't forget the final order by rank desc.


--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html


[quoted text, click to view]

Re: Scaling Rank John Kane
9/23/2004 12:44:15 AM
Nargis,
What you may want to do is setup a method for "Rank Assignment" via
importing your CONTAINSTABLE or FREETEXTTABLE query results into a temp
table (with order by RANK) and along with a new column "AssignedRank" and
then starting at 100 assign each row a decreasing AssignedRank value and
then return this value to the user as the "rank" values. You can use a
Top_N_Rank value of 100 to limit the results to 100 rows.

If this is not what you're looking for, could you provide a more specific
example with the query results you expect?
Thanks,
John



[quoted text, click to view]

AddThis Social Bookmark Button