[extensions-web/wip/ne0sight: 2/2] search: prefer lower bound of search results instead of estimated.
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web/wip/ne0sight: 2/2] search: prefer lower bound of search results instead of estimated.
- Date: Sun, 24 Nov 2019 20:03:45 +0000 (UTC)
commit 68e9a95fbacf0737082dd44ea8c3692697d1a892
Author: Yuri Konotopov <ykonotopov gnome org>
Date: Mon Nov 25 00:03:43 2019 +0400
search: prefer lower bound of search results instead of estimated.
That way we will not show nonexistent pages in search results.
Closes: https://gitlab.gnome.org/Infrastructure/extensions-web/issues/15
sweettooth/extensions/views.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 13e4ef3..cbf85f5 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -217,8 +217,8 @@ def ajax_query_search_query(request, versions, n_per_page):
mset = enquire.get_mset(offset, database.get_doccount())
num_pages = 1
else:
- mset = enquire.get_mset(offset, n_per_page)
- num_pages = int(ceil(float(mset.get_matches_estimated()) / n_per_page))
+ mset = enquire.get_mset(offset, n_per_page, 5 * n_per_page)
+ num_pages = int(ceil(float(mset.get_matches_lower_bound()) / n_per_page))
pks = [match.document.get_data().decode('utf-8') for match in mset]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]