diff options
author | Adam Tauber <asciimoo@gmail.com> | 2016-07-16 21:37:40 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2016-07-16 21:44:17 +0200 |
commit | 485da54961d3cdbc4e3fd33fab90fea6407932ea (patch) | |
tree | 2c2ab7607c7a0b5486903db9232c0f5cf911c3a1 /searx/results.py | |
parent | 9393887eac297fd0007382f62e818a90b283d63b (diff) | |
download | searxng-485da54961d3cdbc4e3fd33fab90fea6407932ea.tar.gz searxng-485da54961d3cdbc4e3fd33fab90fea6407932ea.zip |
[mod][fix] use the average of results number ++ do not display smaller result number than the actual result count - closes #600
Diffstat (limited to 'searx/results.py')
-rw-r--r-- | searx/results.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/searx/results.py b/searx/results.py index 4bb0de0d8..8e74fb10f 100644 --- a/searx/results.py +++ b/searx/results.py @@ -100,7 +100,7 @@ class ResultContainer(object): self._infobox_ids = {} self.suggestions = set() self.answers = set() - self.number_of_results = 0 + self._number_of_results = [] def extend(self, engine_name, results): for result in list(results): @@ -114,7 +114,7 @@ class ResultContainer(object): self._merge_infobox(result) results.remove(result) elif 'number_of_results' in result: - self.number_of_results = max(self.number_of_results, result['number_of_results']) + self._number_of_results.append(result['number_of_results']) results.remove(result) with RLock(): @@ -253,3 +253,9 @@ class ResultContainer(object): def results_length(self): return len(self._merged_results) + + def results_number(self): + resultnum_sum = sum(self._number_of_results) + if not resultnum_sum or not self._number_of_results: + return 0 + return resultnum_sum / len(self._number_of_results) |