all groups > sql server full text search > august 2006 >
You're in the

sql server full text search

group:

Using a different column to rank ft search results



Re: Using a different column to rank ft search results Hilary Cotter
8/21/2006 12:00:00 AM
sql server full text search: You would do this

select top 100 id from ExampleTable join on (select [key], rank from
containstable(exampletable,doctext,'"foo*")) as k
join k.[key]=ExampleTable.id
order by rank desc

or
select id from ExampleTable join on (select [key], rank from
containstable(exampletable,doctext,'"foo*",100)) as k
join k.[key]=ExampleTable.id
order by rank desc


--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

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

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Using a different column to rank ft search results DC
8/21/2006 3:17:50 AM
Hi,

I am currently using the third party product "SQL Turbo" on SQL Server
2000 to archive this:

I have a table:

id DocText DocScore
1 foo foo 2
2 bar bar 1
.... (approx. 1 mio. entries)

Now with SQL Turbo I can do something like this:

select top 100 id from ExampleTable where contains(DocText, '"foo*")
order by DocScore desc

(the actual query looks different and relies on a prepared index for
DocScore).

I require this, since a fulltext search in my application easily
matches 250,000 documents and I need to efficiently just pull out the
first few hundreds with the highest scores.

While SQL Turbo works (and its index population speed is incredible) it
also has some flaws (for example I cannot get the automatical
population to work) and it looks as if the product is not supported
anymore.

I looked out for a similar functionality in SQL Server 2005 to no
avail. Did I overlook something or does somebody maybe know a
workaround? If possible, I would like to retire SQL Turbo while
switching to SQL Server 2005.

Regards
DC
Re: Using a different column to rank ft search results DC
8/21/2006 5:06:59 AM
Thank you, but "rank" is what the indexing engine thinks the rank
should be, while in my application DocScore is actually a more
elaborate column that for example contains the information how often
the document has been viewed.

So is "rank" still the only column the SQL Server 2005 FT engine can
sort by (without diggin up all matches and sort through those)? This
was all SQL Server 2000 could do.

[quoted text, click to view]
Re: Using a different column to rank ft search results Hilary Cotter
8/21/2006 9:02:09 AM
No, you can sort by anything, sort by docscore if you want. I just assumed
you would want rank:)

--
Hilary Cotter
Director of Text Mining and Database Strategy
RelevantNOISE.Com - Dedicated to mining blogs for business intelligence.

This posting is my own and doesn't necessarily represent RelevantNoise's
positions, strategies or opinions.

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

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com



[quoted text, click to view]

Re: Using a different column to rank ft search results Daniel Crichton
8/22/2006 12:00:00 AM
DC wrote on 21 Aug 2006 03:17:50 -0700:

[quoted text, click to view]


You can use exactly what you wrote to do your ordering:

select top 100 id from ExampleTable where contains(DocText, '"foo*")
order by DocScore desc


I use this form all the time to sort by columns that the FTS has no idea
about.

Dan

Re: Using a different column to rank ft search results DC
8/22/2006 9:00:10 AM
Yes, something like

select top 10 Name, StandardCost
from Production.Product
where contains(Name, '"Mount*"')
order by ListPrice desc

does work, the problem is that the FTS will dig up all matching rows
first (and in my application there are usually a lot of hits) and then
SQL Server will sort there and return the top 10 rows.

With SQL Turbo my queries are a lot faster, since I can specify an
additional ordering index (which may also reside in a different table)
and sort by that index. The SQL Trubo fulltext engine will then only
return the top n rows that I have specified.

The containstable statement allows a similar functionality, like in
Hilary's example:

select top 10 Name, StandardCost from Production.Product
join (
select [key], rank from
containstable(Production.Product, Name, '"Mount*"', 1000)
) as k
on k.[key]= Production.Product.ProductID
order by ListPrice desc

The containstable statement will only return the first 1000 rows here,
but these will always be sorted by rank. I need this sorted be
ListPrice instead. If I do this:

select top 10 Name, StandardCost from Production.Product
join (
select [key], rank from
containstable(Production.Product, Name, '"Mount*"', 10)
) as k
on k.[key]= Production.Product.ProductID
order by ListPrice desc

I will not get the 10 matching rows with the highest ListPrice.


[quoted text, click to view]
Re: Using a different column to rank ft search results Daniel Crichton
8/23/2006 12:00:00 AM
As Hilary pointed out, MS FTS doesn't work like this. Are you sure SQL Turbo
isn't supported? Quest Software are still listing it on their current
products page, and KB articles have been added within at least the past
month to their site. Have you tried contacting them? http://www.quest.com

Dan

DC wrote on 22 Aug 2006 09:00:10 -0700:

[quoted text, click to view]

Re: Using a different column to rank ft search results DC
8/24/2006 6:46:59 AM
Our admins told me the product was sold twice and that they would not
get an updated version (and the current version has a couple of flaws),
but I will check again. I will also check if FTS does maybe meet our
performance requirements in the 2005 version although it digs up all
the FT matches.

Thank you, Hilary and Daniel!

[quoted text, click to view]
AddThis Social Bookmark Button