Skip to content

Commit

Permalink
Further optimize excluding results in not queries
Browse files Browse the repository at this point in the history
Usually the number of the parameters that have to be excluded in the not query is much lower than the number of values in the index, so it makes sense to actually try to pop them out from the list
  • Loading branch information
ale-rt committed Oct 29, 2021
1 parent d94e333 commit c56802d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Products/PluginIndexes/unindex.py
Expand Up @@ -504,7 +504,12 @@ def query_index(self, record, resultset=None):
i_not_parm = self._apply_not(not_parm, resultset)
if i_not_parm:
return difference(resultset, i_not_parm)
record.keys = [k for k in index.keys() if k not in not_parm]
record.keys = list(index)
for parm in not_parm:
try:
record.keys.remove(parm)
except ValueError:
pass
else:
# convert query arguments into indexed format
record.keys = list(map(self._convert, record.keys))
Expand Down

0 comments on commit c56802d

Please sign in to comment.