[extensions-web/deploy] search: prefer lower bound of search results instead of estimated.



commit 0dae104c0f9b23817156280ae9c7cb05737dfdd9
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 c888612..c51df53 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -213,8 +213,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() for match in mset]
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]