Full-Text Search - Weight / Ranking
Posted on 2003-10-29
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.