Hi; I'm working on a search script and i want to assign weigths for different criterias for my articles like title %15 content %50 hits %5 creation date %10 (maybe more criterias come here) etc. I need ideas for this or any articles which is related with this. Thanks for the comments
I suggest something like this : 1 - Fetch the results of a DB query like this ("SELECT title, content,... FROM db_table WHERE some strings comparaison is true") on an array 2 - for each table row generate a % for each criteria, for example : * Title % will be equal to : (15 * number_of_search_terms_found / number_of_search_terms)% * Same for content * The table row with the biggest hits value will have a % of 5 for the hits criteria, and the row with the lowest hits count will have 0%, other rows well be calculated : hits % = (5 * row_hits_count/biggest_hits_count)% * Same for creation date (using timestamp instead of hits count). Then calculate the criterias % total and sort the table. Sorry for mistakes... I wrote this in a hurry !