Skip to content

Commit

Permalink
Added eager loading ability when specified in the searchable declarat…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
Cameron Hurst committed May 16, 2011
1 parent 125fb0e commit 1cc2e3f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/sunspot/index_queue/entry.rb
Expand Up @@ -105,7 +105,9 @@ def load_all_records(entries)
map = entries.inject({}){|hash, entry| hash[entry.record_id.to_s] = entry; hash}
classes.each do |klass|
ids = entries.collect{|entry| entry.record_id}
Sunspot::Adapters::DataAccessor.create(klass).load_all(ids).each do |record|
adapter = Sunspot::Adapters::DataAccessor.create(klass)
adapter.include = klass.sunspot_options[:include]
adapter.load_all(ids).each do |record|
entry = map[Sunspot::Adapters::InstanceAdapter.adapt(record).id.to_s]
entry.instance_variable_set(:@record, record) if entry
end
Expand Down

0 comments on commit 1cc2e3f

Please sign in to comment.