Skip to content

Commit

Permalink
Fix parameter handling for 'not' and 'range'
Browse files Browse the repository at this point in the history
  • Loading branch information
andbag committed Mar 21, 2019
1 parent dd30d44 commit 84950ad
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions src/Products/PluginIndexes/CompositeIndex/CompositeIndex.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,21 @@ def make_query(self, query):
query_operators = QUERY_OPERATORS[c.meta_type]
rec = IndexQuery(query, c.id, query_options,
query_operators[0], query_operators[1])
opr = None

# not supported: 'not' parameter
not_parm = rec.get('not', None)
if not rec.keys and not_parm:
if not_parm:
continue

# not supported: range parameter
range_parm = rec.get('range', None)
if range_parm:
opr = 'range'
if rec.get('usage', None):
# see if any usage params are sent to field
opr = rec.usage.lower().split(':')
if opr == 'range':
continue

# not supported: 'and' operator
Expand All @@ -351,16 +362,20 @@ def make_query(self, query):
if len(c_records) < MIN_COMPONENTS:
return query

kw_list = []
for c_id, rec in c_records:
kw = rec.keys
if not kw:
continue
def tuple_cast(kw):
if isinstance(kw, list):
kw = tuple(kw)
elif not isinstance(kw, tuple):
kw = (kw,)
kw = tuple([(c_id, k) for k in kw])
return kw

kw_list = []
for c_id, rec in c_records:
keys = rec.keys
if not keys:
continue
keys = tuple_cast(keys)
kw = tuple([(c_id, k) for k in keys])
kw_list.append(kw)

# permute keyword list
Expand Down

0 comments on commit 84950ad

Please sign in to comment.