mirror of https://github.com/searxng/searxng.git
[enh] score stat mods
This commit is contained in:
parent
09154c1f01
commit
0f301adf60
|
@ -137,7 +137,6 @@ def search(query, request, selected_categories):
|
||||||
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)*settings.weights.get(res['engine'], 1)
|
||||||
engines[res['engine']].stats['score_count'] += score
|
|
||||||
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\
|
||||||
|
@ -159,6 +158,10 @@ def search(query, request, selected_categories):
|
||||||
res['score'] = score
|
res['score'] = score
|
||||||
results.append(res)
|
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)
|
return sorted(results, key=itemgetter('score'), reverse=True)
|
||||||
|
|
||||||
def get_engines_stats():
|
def get_engines_stats():
|
||||||
|
|
Loading…
Reference in New Issue