From dd0e1496e6f88d7262e2d51d7c52dbf3e2b1611f Mon Sep 17 00:00:00 2001 From: Robert Sparks Date: Thu, 4 Nov 2021 19:30:26 +0000 Subject: [PATCH] Adjust when we truncate search results. Commit ready for merge. - Legacy-Id: 19552 --- ietf/doc/utils_search.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ietf/doc/utils_search.py b/ietf/doc/utils_search.py index 87293f60f..694c007af 100644 --- a/ietf/doc/utils_search.py +++ b/ietf/doc/utils_search.py @@ -151,16 +151,16 @@ def prepare_document_table(request, docs, query=None, max_results=200): displaying a full table of information about the documents, plus dict with information about the columns.""" - if docs.count() > max_results: - docs = docs[:max_results] - if not isinstance(docs, list): # evaluate and fill in attribute results immediately to decrease # the number of queries docs = docs.select_related("ad", "std_level", "intended_std_level", "group", "stream", "shepherd", ) docs = docs.prefetch_related("states__type", "tags", "groupmilestone_set__group", "reviewrequest_set__team", "ad__email_set", "docalias__iprdocrel_set") + docs = docs[:max_results] # <- that is still a queryset, but with a LIMIT now docs = list(docs) + else: + docs = docs[:max_results] fill_in_document_table_attributes(docs) augment_docs_and_user_with_user_info(docs, request.user)