Re: Rating results after relevance. Difficult problem
| From: | heinisch at creaction dot de | Date: | Wed, 08 May 2002 22:47:13 +0000 |
| Subject: | Re: Rating results after relevance. Difficult problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96703@lists.php.net to get a copy of this message | ||
At 08.05.2002 20:50, you wrote:
Hi there: I am working on a member search engine. Regarding on the criterias a user provides (like should speek english, should be interested in arts...) the machine querries the db and returns the results. But I would like to rate the results. So All criterias fitt... 100%, Just 1 of 3 -> 33 % and so on. I did already finish my coding and works fine for a user amount of 20. But now I generated 2000 random users and woww!!! Take about 2 minitues to querry!! So there has to be a better way, right? What I am doing with this version, is to get all the users fitting the criteria. Opening a temporary table store the id and the amount of fitting criterias in it. Retriving this temporary table and sort it after the most wanted user (100% max). The problem with this, is that on user takes about 0.04 s to check and store in the temp table. If there are 2000 users fitting at least one of the criterias thats 2000 * 0.04 s means 400 s = lots of time! Not to imagine what happens if there are 100.000 users in the db!!! So the querry performance is ok, I just need to find a more effective way to rate them. There are 3 tables. - user table with most of the data - language table, containing the languages the user speak (by the time of registering they can select up to 3 languages) - interest table, containing the interests of the users (by the time of registering they can select up to 20 interests) Can anybody help on that difficult topic? I would really apreciate any hint on that. Thanx in advance, AndyWhat if you put your criteria in a coded way in the db I think about something like an binary coded number, or bit-oriented way. f.e. english = 000000000001 french = 000000000010 so if one is able to speak english & french the number will be 000000000011 or you make it bitwise english = 1 french = 2 dutch = 4 and store 3 in the db, if it speakes english and french. 6 if it speaks french and dutch and so on. A little class could easily add and restore the data from/to the numbers. so you only have to put user_id and characteristics in the db which should be easier to select, group, calculate... if you get the results, you can ask the user table for more informations. HTH Oliver