forked from Ponysearch/Ponysearch
[enh] score stat mods
This commit is contained in:
parent
09154c1f01
commit
0f301adf60
1 changed files with 4 additions and 1 deletions
|
@ -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 a new issue