Fix #5177: ordfav with commentary search raises exception.

This commit is contained in:
evazion
2022-05-20 22:59:02 -05:00
parent 0fe9356bf6
commit 9867514a78
2 changed files with 14 additions and 3 deletions

View File

@@ -242,9 +242,15 @@ class PostQueryBuilder
in :not
children.first.negate_relation
in :and
children.reduce(&:and)
joins = children.flat_map(&:joins_values)
orders = children.flat_map(&:order_values)
nodes = children.map { |child| child.joins(joins).order(orders) }
nodes.reduce(&:and)
in :or
children.reduce(&:or)
joins = children.flat_map(&:joins_values)
orders = children.flat_map(&:order_values)
nodes = children.map { |child| child.joins(joins).order(orders) }
nodes.reduce(&:or)
end
end
end