[mod] scoring mods

This commit is contained in:
asciimoo 2013-10-27 14:48:16 +01:00
parent 0f301adf60
commit f01e67dbd4
1 changed files with 2 additions and 2 deletions

View File

@ -136,7 +136,7 @@ def search(query, request, selected_categories):
for i,res in enumerate(flat_res): for i,res in enumerate(flat_res):
res['parsed_url'] = urlparse(res['url']) res['parsed_url'] = urlparse(res['url'])
res['engines'] = [res['engine']] res['engines'] = [res['engine']]
score = (flat_len - i)*settings.weights.get(res['engine'], 1) score = (flat_len - i - flat_len%len(engines))*settings.weights.get(res['engine'], 1)
duplicated = False duplicated = False
for new_res in results: for new_res in results:
if res['parsed_url'].netloc == new_res['parsed_url'].netloc and\ if res['parsed_url'].netloc == new_res['parsed_url'].netloc and\
@ -176,7 +176,7 @@ def get_engines_stats():
results_num = engine.stats['result_count']/float(engine.stats['search_count']) results_num = engine.stats['result_count']/float(engine.stats['search_count'])
load_times = engine.stats['page_load_time']/float(engine.stats['search_count']) load_times = engine.stats['page_load_time']/float(engine.stats['search_count'])
if results_num: if results_num:
score = engine.stats['score_count'] / float(engine.stats['search_count']) / results_num score = engine.stats['score_count'] / float(engine.stats['search_count'])
else: else:
score = 0 score = 0
max_results = max(results_num, max_results) max_results = max(results_num, max_results)