Skip to content

Commit

Permalink
Make partial-index strategy higher priority, specify left_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeMonkeySteve committed Sep 19, 2021
1 parent fcebbf2 commit ab81945
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/no_brainer/criteria/where.rb
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def find_strategy_compound_partial
end
left_bound.append *Array.new(pad, RethinkDB::RQL.new.minval)
right_bound.append *Array.new(pad, RethinkDB::RQL.new.maxval)
return IndexStrategy.new(self, ast, partial_clauses, index, :between, [left_bound, right_bound], :right_bound => :closed)
return IndexStrategy.new(self, ast, partial_clauses, index, :between, [left_bound, right_bound], :left_bound => :closed, :right_bound => :closed)
end
end
nil
Expand Down Expand Up @@ -485,7 +485,7 @@ def find_strategy_union
def find_strategy
return nil unless ast.try(:clauses).present? && !criteria.without_index?
case ast.op
when :and then find_strategy_compound || find_strategy_canonical || find_strategy_hidden_between || find_strategy_compound_partial
when :and then find_strategy_compound || find_strategy_compound_partial || find_strategy_canonical || find_strategy_hidden_between
when :or then find_strategy_union
end
end
Expand Down

0 comments on commit ab81945

Please sign in to comment.