mirror of
https://github.com/searxng/searxng.git
synced 2025-07-15 01:09:21 +02:00
[enh][mod] result handling refactor
Several changes has been made: - Parallel result merge - Scoring algorithm slightly changed (see result_score()) - Proper Thread locking on global data manipulation
This commit is contained in:
parent
0ad272c5cb
commit
b6c3cb0bdd
6 changed files with 321 additions and 292 deletions
|
@ -1,25 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from searx.search import score_results
|
||||
from searx.testing import SearxTestCase
|
||||
|
||||
|
||||
def fake_result(url='https://aa.bb/cc?dd=ee#ff',
|
||||
title='aaa',
|
||||
content='bbb',
|
||||
engine='wikipedia'):
|
||||
return {'url': url,
|
||||
'title': title,
|
||||
'content': content,
|
||||
'engine': engine}
|
||||
# TODO
|
||||
class SearchTestCase(SearxTestCase):
|
||||
|
||||
|
||||
class ScoreResultsTestCase(SearxTestCase):
|
||||
|
||||
def test_empty(self):
|
||||
self.assertEqual(score_results(dict()), [])
|
||||
|
||||
def test_urlparse(self):
|
||||
results = score_results(dict(a=[fake_result(url='https://aa.bb/cc?dd=ee#ff')]))
|
||||
parsed_url = results[0]['parsed_url']
|
||||
self.assertEqual(parsed_url.query, 'dd=ee')
|
||||
def test_(self):
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue