438
439
440
441
442
443
444
445
446
447
448
|
# File 'lib/no_brainer/criteria/where.rb', line 438
def find_strategy_compound
clauses = Hash[get_candidate_clauses(:eq).map { |c| [c.key_path, c] }]
return nil unless clauses.present?
get_usable_indexes(:kind => :compound, :geo => false, :multi => false).each do |index|
indexed_clauses = index.what.map { |field| clauses[[field]] }
next unless indexed_clauses.all? { |c| c.try(:compatible_with_index?, index) }
return IndexStrategy.new(self, ast, indexed_clauses, index, :get_all, [indexed_clauses.map(&:value)])
end
return nil
end
|