lib/bmg/operator/constants.rb in bmg-0.9.1 vs lib/bmg/operator/constants.rb in bmg-0.10.0
- old
+ new
@@ -54,9 +54,21 @@
[ :constants, operand.to_ast, constants.dup ]
end
protected ### optimization
+ def _page(type, ordering, page_index, options)
+ attrs = ordering.map{|(k,v)| k}
+ cs_attrs = constants.keys
+ if (attrs & cs_attrs).empty?
+ operand
+ .page(ordering, page_index, options)
+ .constants(constants)
+ else
+ super
+ end
+ end
+
def _restrict(type, predicate)
# bottom_p makes no reference to constants, top_p possibly
# does...
top_p, bottom_p = predicate.and_split(constants.keys)
if top_p.tautology?