forked from Ponysearch/Ponysearch
[mod] results engines mods
This commit is contained in:
parent
8114439575
commit
09154c1f01
1 changed files with 2 additions and 1 deletions
|
@ -135,6 +135,7 @@ def search(query, request, selected_categories):
|
||||||
# deduplication + scoring
|
# deduplication + scoring
|
||||||
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']]
|
||||||
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
|
engines[res['engine']].stats['score_count'] += score
|
||||||
duplicated = False
|
duplicated = False
|
||||||
|
@ -149,7 +150,7 @@ def search(query, request, selected_categories):
|
||||||
if len(res.get('content', '')) > len(duplicated.get('content', '')):
|
if len(res.get('content', '')) > len(duplicated.get('content', '')):
|
||||||
duplicated['content'] = res['content']
|
duplicated['content'] = res['content']
|
||||||
duplicated['score'] += score
|
duplicated['score'] += score
|
||||||
duplicated['engine'] += ', '+res['engine']
|
duplicated['engines'].append(res['engine'])
|
||||||
if duplicated['parsed_url'].scheme == 'https':
|
if duplicated['parsed_url'].scheme == 'https':
|
||||||
continue
|
continue
|
||||||
elif res['parsed_url'].scheme == 'https':
|
elif res['parsed_url'].scheme == 'https':
|
||||||
|
|
Loading…
Reference in a new issue