Commit d8557642 authored by Hanno Schlichting's avatar Hanno Schlichting

Avoid overriding the all keyword and combine sort and reverse calls into one

parent 21c4e9e6
...@@ -869,15 +869,16 @@ def mergeResults(results, has_sort_keys, reverse): ...@@ -869,15 +869,16 @@ def mergeResults(results, has_sort_keys, reverse):
# Concatenate the catalog results into one list and sort it # Concatenate the catalog results into one list and sort it
# Each result record consists of a list of tuples with three values: # Each result record consists of a list of tuples with three values:
# (sortkey, docid, catalog__getitem__) # (sortkey, docid, catalog__getitem__)
combined = []
if len(results) > 1: if len(results) > 1:
all = []
for r in results: for r in results:
all.extend(r) combined.extend(r)
elif len(results) == 1: elif len(results) == 1:
all = results[0] combined = results[0]
else: else:
return [] return []
all.sort()
if reverse: if reverse:
all.reverse() combined.sort(reverse=True)
return LazyMap(lambda rec: rec[2](rec[1]), all, len(all)) else:
combined.sort()
return LazyMap(lambda rec: rec[2](rec[1]), combined, len(combined))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment