Skip to content

Commit 9256dac

Browse files
authored
[core][fix] Do not use arangosearch for nested array context searches (#2178)
1 parent bdc974a commit 9256dac

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

fixcore/fixcore/db/arango_query.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,20 @@ def view_term(term: Term) -> Tuple[Optional[str], Term]:
263263
return (None, term) if sp is None else (sp, evolve(term, pre_filter=pre))
264264
elif isinstance(term, NotTerm):
265265
sp, nt = view_term(term.term)
266-
return (None, term) if sp is None else (f"NOT ({sp})", NotTerm(nt))
266+
remaining = nt if nt.is_all else NotTerm(nt) # a remaining filter needs to be negated
267+
return (None, term) if sp is None else (f"NOT ({sp})", remaining)
267268
elif isinstance(term, ContextTerm):
268269
# context terms cannot be handled by the view search exhaustively
269270
# we filter the list down as much as possible, but leave the context term untouched
270271
is_array_context = bool(array_marker.search(term.name))
271272
context_in_array = context_in_array or is_array_context
272-
sp, ct = view_term(term.predicate_term())
273-
return sp, term if is_array_context else ct
273+
# arangosearch view does not handle nested array searches correctly
274+
# see: https://github.com/arangodb/arangodb/issues/21281
275+
# once this is resolved we can enable the next 3 lines
276+
#
277+
# sp, ct = view_term(term.predicate_term())
278+
# return sp, term if is_array_context else ct
279+
return (None, term) if is_array_context else view_term(term.predicate_term())
274280
elif isinstance(term, IdTerm):
275281
if len(term.ids) == 1:
276282
sp = f"{crs}._key == @{ctx.add_bind_var(term.ids[0])}"

0 commit comments

Comments
 (0)