summaryrefslogtreecommitdiff
path: root/searx/results.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2026-05-25 12:43:02 +0200
committerGitHub <noreply@github.com>2026-05-25 12:43:02 +0200
commitdd27fce3b7b5a14e4855474ead81447adbf73d7d (patch)
tree47d321c0da2b93e67d1bec0d44ac018864cffcb5 /searx/results.py
parentefc305b7f98399da2acc8596a496ad408c704d7b (diff)
[unbload] drop meaningless field ``number_of_results_xpath`` from results (#6130)
In the result-list, the ``number_of_results`` indicate the number of hits in the Index, they do not indicate how many results are in the answer. In the past, search engines such as google or ddg had an indication on the first page of a search term of how many hits there were for this term in total in their index. This info was added up in SearXNG and delivered under ``number_of_results``. Nowadays the search engines no longer indicate how many hits there are in the index and so this field in SearXNG is also superfluous. - https://github.com/searxng/searxng/issues/2457#issuecomment-2566181574 - https://github.com/searxng/searxng/issues/2987 - https://github.com/searxng/searxng/issues/5034 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/results.py')
-rw-r--r--searx/results.py25
1 files changed, 0 insertions, 25 deletions
diff --git a/searx/results.py b/searx/results.py
index f3bac2eb7..01c80ae06 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -69,7 +69,6 @@ class ResultContainer:
self.answers = AnswerSet()
self.corrections = set()
- self._number_of_results: list[int] = []
self.engine_data: dict[str, dict[str, str]] = defaultdict(dict)
self._closed: bool = False
self.paging: bool = False
@@ -135,11 +134,6 @@ class ResultContainer:
self._merge_infobox(result)
continue
- if "number_of_results" in result:
- if self.on_result(result):
- self._number_of_results.append(result["number_of_results"])
- continue
-
if "engine_data" in result:
if self.on_result(result):
if result.engine:
@@ -252,25 +246,6 @@ class ResultContainer:
self._main_results_sorted = gresults
return self._main_results_sorted
- @property
- def number_of_results(self) -> int:
- """Returns the average of results number, returns zero if the average
- result number is smaller than the actual result count."""
-
- if not self._closed:
- log.error("call to ResultContainer.number_of_results before ResultContainer.close")
- return 0
-
- with self._lock:
- resultnum_sum = sum(self._number_of_results)
- if not resultnum_sum or not self._number_of_results:
- return 0
-
- average = int(resultnum_sum / len(self._number_of_results))
- if average < len(self.get_ordered_results()):
- average = 0
- return average
-
def add_unresponsive_engine(self, engine_name: str, error_type: str, suspended: bool = False):
with self._lock:
if self._closed: