summaryrefslogtreecommitdiff
path: root/searx/results.py
diff options
context:
space:
mode:
authorDalf <alex@al-f.net>2019-11-15 09:31:37 +0100
committerDalf <alex@al-f.net>2019-11-15 09:33:15 +0100
commit85b37233458c21b775bf98568c0a5c9260aa14fe (patch)
tree4b79330d170d3f8dbc0c52dadbfef429c31b2187 /searx/results.py
parent42d5e2c02cd4715a0e09411efbb249ef5d8defed (diff)
downloadsearxng-85b37233458c21b775bf98568c0a5c9260aa14fe.tar.gz
searxng-85b37233458c21b775bf98568c0a5c9260aa14fe.zip
[mod] speed optimization
compile XPath only once avoid redundant call to urlparse get_locale(webapp.py): avoid useless call to request.accept_languages.best_match
Diffstat (limited to 'searx/results.py')
-rw-r--r--searx/results.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/searx/results.py b/searx/results.py
index a127024c8..3b1e4bd62 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -67,8 +67,9 @@ def merge_two_infoboxes(infobox1, infobox2):
for url2 in infobox2.get('urls', []):
unique_url = True
- for url1 in infobox1.get('urls', []):
- if compare_urls(urlparse(url1.get('url', '')), urlparse(url2.get('url', ''))):
+ parsed_url2 = urlparse(url2.get('url', ''))
+ for url1 in urls1:
+ if compare_urls(urlparse(url1.get('url', '')), parsed_url2):
unique_url = False
break
if unique_url:
@@ -188,8 +189,9 @@ class ResultContainer(object):
add_infobox = True
infobox_id = infobox.get('id', None)
if infobox_id is not None:
+ parsed_url_infobox_id = urlparse(infobox_id)
for existingIndex in self.infoboxes:
- if compare_urls(urlparse(existingIndex.get('id', '')), urlparse(infobox_id)):
+ if compare_urls(urlparse(existingIndex.get('id', '')), parsed_url_infobox_id):
merge_two_infoboxes(existingIndex, infobox)
add_infobox = False