Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Flake8 problems. #1

Open
wants to merge 1 commit into
base: bettertests
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/Products/ZCatalog/Catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,16 +921,18 @@ def _multi_index_nbest(self, actual_result_count, result,
lopez 4
meier 2

Even if the two first data sets suffice for the requirement limit=2 the third dataset have to be take into account
when sorting on both indexes.
Even if the two first data sets suffice for the requirement limit=2 the
third dataset have to be take into account when sorting on both
indexes.

For multiple indexes the strategy is :
1) For the first index get the index_values for all documents
Result :
Result:
['meier', 'lopez', 'meier', 'smith']

2) Sort the index_values using heapq to get the 'limit' largest/smallest index_values
Result :
2) Sort the index_values using heapq to get the 'limit'
largest/smallest index_values
Result:
['lopez', 'meier']

3) Find all documents having index_values 'lopez' or 'meier'
Expand Down Expand Up @@ -987,20 +989,21 @@ def _multi_index_nbest(self, actual_result_count, result,
if last_index_value != current_index_value:
# We have a fresh index_value
# store all belonging documents
all_documents_for_sorting += list(sort_index._index[current_index_value])
all_documents_for_sorting += list(
sort_index._index[current_index_value])
# remenber the index_value for duplicate checking
last_index_value = current_index_value

# Step 4) Get the index_values for the other search indexes
# The sort_set includes the list of index_values per document
sort_set = []
for did in all_documents_for_sorting:
for did in all_documents_for_sorting:
# get the primary index_value
idx = index_key_map[did]
# add the secondary index values
full_key = (idx, )
for km in second_indexes_key_map:
full_key += (km[did], )
full_key += (km[did], )
sort_set.append((full_key, did, self.__getitem__))

# Step 5) Sort after the secondary indexes.
Expand Down