Skip to content

Commit

Permalink
fixes to conditional search
Browse files Browse the repository at this point in the history
  • Loading branch information
gpizzorno committed Dec 4, 2020
1 parent 485e713 commit 5fce038
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions dalme_app/utils/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,22 @@ def build_query(self):
return False

bool_sets = {'must': [], 'should': [], 'must_not': []}
for row in data:
join = row.get('join_type', False)
child_rel = False
child_highlight = False

for i, row in enumerate(data):
join = row.get('join_type', False) if i > 0 else 'should'
method = getattr(self, row.get('field_type'), False)

if row.get('child_relationship', False):
if child_rel and child_highlight:
row['highlight'] = False

elif row.get('highlight', False):
child_highlight = True

child_rel = True

if method:
query, highlight, error = method(row)
if join and query:
Expand Down Expand Up @@ -264,8 +276,7 @@ def text(data):

child_object = {
'type': data['child_relationship'],
'query': query,
'inner_hits': {}
'query': query
}

if data.get('highlight', False):
Expand Down

0 comments on commit 5fce038

Please sign in to comment.