From 0f301adf60ace81dd1ceef16fe568d9a6d71c939 Mon Sep 17 00:00:00 2001 From: asciimoo Date: Sun, 27 Oct 2013 14:39:23 +0100 Subject: [PATCH] [enh] score stat mods --- searx/engines/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index 0a2d504d5..3f97c59c6 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -137,7 +137,6 @@ def search(query, request, selected_categories): res['parsed_url'] = urlparse(res['url']) res['engines'] = [res['engine']] score = (flat_len - i)*settings.weights.get(res['engine'], 1) - engines[res['engine']].stats['score_count'] += score duplicated = False for new_res in results: if res['parsed_url'].netloc == new_res['parsed_url'].netloc and\ @@ -159,6 +158,10 @@ def search(query, request, selected_categories): res['score'] = score results.append(res) + for result in results: + for res_engine in result['engines']: + engines[result['engine']].stats['score_count'] += result['score'] + return sorted(results, key=itemgetter('score'), reverse=True) def get_engines_stats():