04. november 2002 - 23:38Der er
3 kommentarer og 1 løsning
Vægtning af søgeord
Hej!
Jeg har bygget et mini-"Content Management" system baseret på ASP og en Access database.
Informationerne ligger i forskellige tabeller, f.eks. Produkter, Nyheder og Dokumenter.
Nu vil jeg så forsøge at bygge en søgefunktion, som kan søge på tværs af disse tabeller.
Er der nogen der har nogle råd og/eller tips til hvordan man gør det?
Det er nemt nok at tage brugerens søgeord og så bare fyre 3 forespørgsler af på de 3 tabeller, men resultatet skulle meget gerne være vægtet/sorteret, så det for brugeren mest relevante "hit" kommer øverst?
AI requires alot of 1) work or 2) data to accomplish weighted searches.
Jubii uses "kold hårdt kontant-DKK", Yahoo og Google use traffic (thru-click) information to determine which search results are the most popular, this is a backwards chaining type of AI. It requires that you keep track of the most popular pages AND which pages people went to after searching for a particular string. You might have a table with Search String ResultArticleID ClickThruCount These records are created on search, and constantly updated with ClickThruCount, based on the users choice.
Forward Chaining AI could be something like a complex index of all words in your database, and how many times they appear, so that articles with more occurances of the word would be at the top of the search. This requires a very complex (not that complex but really slow) routine everytime you save information in the database.
Easiest, and how I've done it in PHP content management systems, would just weight the articles by table, saved date, and number of reads (hits).
maybe Nyheder is the most important table, followed by dokumenter and then produkter. But if the nyheder post is older than one year and the proudkter is less than 6 months, it might be more important. This might require a few more SQL calls, but you can play with it and see how performance is effected.
...Men desværre er der jo tale om en Access database :-)
Inspireret af din post har jeg nu fået konstrueret en søgefunktion vha. et Custom Recordset, der først bliver fyldt med data fra 3 forespørgsler ned i de 3 tabeller med data (Produkter, Nyheder, Dokumenter). Derefter bliver det sorteret via recordset metoden sort (ex. rstSearchResult.Sort "WordCount DESC, HitCount DESC, Date DESC").
Det virker ganske fint, og giver udemærkede muligheder for at sortere resultatet. Hvordan det så performer er en hel anden historie, men vi har jo også med Access at gøre...
Tak for inspirationen, det var lige det jeg manglede!
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.