Skip to content

Commit

Permalink
Prepare index_object for multiple indexed attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
andbag committed May 23, 2019
1 parent b529bd2 commit 6b7b84d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Products/PluginIndexes/unindex.py
Expand Up @@ -248,7 +248,10 @@ def index_object(self, documentId, obj, threshold=None):
fields = self.getIndexSourceNames()
res = 0
for attr in fields:
res += self._index_object(documentId, obj, threshold, attr)
r = self._index_object(documentId, obj, threshold, attr)
if isinstance(r, tuple):
r, datum = r
res += r

if res > 0:
self._increment_counter()
Expand All @@ -266,7 +269,7 @@ def _index_object(self, documentId, obj, threshold=None, attr=''):
# ordering definition compared to any other object.
# BTrees 4.0+ will throw a TypeError
# "object has default comparison" and won't let it be indexed.
return 0
return (0, datum)

datum = self._convert(datum, default=_marker)

Expand Down Expand Up @@ -297,7 +300,7 @@ def _index_object(self, documentId, obj, threshold=None, attr=''):

returnStatus = 1

return returnStatus
return (returnStatus, datum)

def _get_object_datum(self, obj, attr):
# self.id is the name of the index, which is also the name of the
Expand Down

0 comments on commit 6b7b84d

Please sign in to comment.