Solved

Full-Text Search - Weight / Ranking

Posted on 2003-10-29
3
317 Views
Last Modified: 2008-03-06
I am working on a classified advertising website that allows users to place their adverts online. I have to ask them which 'section' (or classification) the advert needs to go into (i.e. Bicycles, Computer Games etc.).
I am totally new to Full-Text Index and have been looking into it a bit this afternoon but I'm not sure if it can do what I 'ideally' need it to do.

My Classification table has a number of columns, but only 2 of which are used for the search: Description (e.g. Computer Games) and Keywords (a manually populated comma delimitted list of related keywords e.g. games,console games,carts,cartridges etc.)
I have fully populated my index based on these 2 columns.

On the site I ask the user what they are advertising, then perform a search to find the most suitable classification/section for their advert.

I have been playing with the CONTAINS and FREETEXT approaches in SQL Analyser and getting results back which look good, but ideally some of the results need to be listed first on screen, with the 'less likely' results shown last.

For example, if I search on 'FORD FOCUS CAR', I want the 'Ford - Focus' classification to be listed as near the top of the list as possible as it contains 'FORD' and 'FOCUS' in both the Description field AND the Keywords field, whereas other results that were returned may have only been returned because one of the fields may have contained the word 'CAR' once, returning for example 'Car Hire'.

Is there a way I can order my results based on the 'number of occurrences' of the words the user searched for, so as to prioritise those with the closest match?

It may also be worth noting that there are around 1000 classifications/sections in total, hence the need to prioritise a certain amount of results returned to the user.

Any help/suggestions on how I could approach this scenario would be much appreciated!

Thanks in advance.
0
Comment
Question by:Starnzy
  • 2
3 Comments
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 65 total points
ID: 9643446
Have you tried using the "top_n_by_rank" clause.

Anthony
0
 

Author Comment

by:Starnzy
ID: 9648652
Hi Anthony

Not yet no. I'm not familiar with hardly any of the syntax for using Full-Text search. I'm searching round a few sites trying to pick up on the different methods that can be used (i.e. CONTAINS, CONTAINSTABLE, FREETEXT, FREETEXTABLE etc) and trying to work out whats most suitable for my scenario above.
Do you have any example sites/links or code that use this 'top_n_by_rank' clause so I can give it a try?

Thanks
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 65 total points
ID: 9650646
From BOL and MSDN:

Full-text Search
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_15_3rqg.asp

Full-Text Search Recommendations
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/trblsql/tr_faq_6mer.asp

Using the CONTAINSTABLE and FREETEXTTABLE Rowset-valued Functions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_15_1m9f.asp

Also, make sure you have at least SP2 as there was a fix for this. See:
FIX: TOP_N_BY_RANK Argument May Not Return Top N by Rank
http://support.microsoft.com/default.aspx?scid=kb;en-us;308763

Anthony
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now