View Full Version : How do you rate a result in a search?

02-27-2003, 08:11 AM
I have a database search facility, and would like to sort the results according to how well they mach to what was searched for. How do i do this?

02-27-2003, 03:07 PM
Ooooh. This is a hard one.
It痴 not something you値l gone set up with five lines of code. So if you just think of it as a nice extra feature, then leave it. Really.

- you値l need a pretty fast database with lots of indexed variables (the variables you search on must be indexed)
- you値l need to keep a log on the performed searches, so you can optimize your database for searches that are frequently run + to have some duplicate (preprocessed) info in table you don稚 use for your normal processes
- you値l need to think up a sort of scoring algorithem. It probably will be quite specific for your db-design and db-content and application. This algorithme will determine the score. For instance, if you have a booksales-app, and your search for 適ing, well, then you will probably will give more points to a record with 徒ing as author then one with king in the title or publisher. (Or you want the client to be able to specify wich feelds to search first and )
If the keyword is found 10 times, is this then better (higher score) then when it is only found once (in a particular field) ? etc etc etc. You値l have to build a pretty complicated algorithme (on a rainy week or so).
And the choices you make are important. Different search-engines use different scoring algorithems. (For instance: I think it was Yahoo who started counting the number of pages that were linked to a certain page to determine the importance of that page, instead of just counting the appearance of keywords on that page. And the results were much better.)
- Then, you need to track and log what the users do with the searchresults. If 10 users type in 適ing, and they get a resultpage with 10 items, and 9 users click the same item, then this item should get a higher score in the future. Etc etc. So you値l be looking at some sort a neural network to keep track of all this.
- And why not add some CRM (customer relation management) to the mix (cause you really don稚 just wanna show a score, you wanna to point them in the best direction. No ?
- Or you could mix in some context analysis. (You know, stuff like Autonomy and so)
In short: you値l need to do some creative db-management, run some periodical analyses to update your 叢reprocessed info, keep a neural net running and so on.

Or just add a fake value. Something like this

dim starttime,displayvalue

then your select statement


then displaying recordset and after each find, you add this
displayvalue = starttimer timerfound
displayvalue= 1 displayvalue/100
response.write(( & displayvalue & ))
timerfound = 0


02-27-2003, 03:31 PM
Well that was DEFINATELY harder then i thought! I was hoping for an RS method or something... :rolleyes: It makes a lot of sense though. As soon as my site is completely up and running, ill add in the rating system with the things you suggested... It sounds like a nice challenge :)

Thanx for the advice!

02-27-2003, 03:54 PM
Thats the spirit.
It's more fun to code then 'response.write' and the regular monkey work.
If you want to use it in a sort of CRM model, maybe check out this for ideas