Skip to content

Commit e3cd5f5

Browse files
committed
Merged in [19552] from rjsparks@nostrum.com:
Adjust when we truncate search results. - Legacy-Id: 19560 Note: SVN reference [19552] has been migrated to Git commit dd0e149
1 parent 7dc1ec1 commit e3cd5f5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

ietf/doc/utils_search.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ def prepare_document_table(request, docs, query=None, max_results=200):
151151
displaying a full table of information about the documents, plus
152152
dict with information about the columns."""
153153

154-
if docs.count() > max_results:
155-
docs = docs[:max_results]
156-
157154
if not isinstance(docs, list):
158155
# evaluate and fill in attribute results immediately to decrease
159156
# the number of queries
160157
docs = docs.select_related("ad", "std_level", "intended_std_level", "group", "stream", "shepherd", )
161158
docs = docs.prefetch_related("states__type", "tags", "groupmilestone_set__group", "reviewrequest_set__team",
162159
"ad__email_set", "docalias__iprdocrel_set")
160+
docs = docs[:max_results] # <- that is still a queryset, but with a LIMIT now
163161
docs = list(docs)
162+
else:
163+
docs = docs[:max_results]
164164

165165
fill_in_document_table_attributes(docs)
166166
augment_docs_and_user_with_user_info(docs, request.user)

0 commit comments

Comments
 (0)