This repository has been archived by the owner on Jun 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ACTIVEMODEL] Added the
:load
option for search to eagerly load mod…
…el instances from the database In ActiveModel/ActiveRecord implementation, there's an option to load the "real", underlying model with the `load` method. This allows for loading the records only one-by-one, though. An option as `:load => true` for the search methods will eagerly load all the records from the database (in Results::Tire::Collection#results), based on IDs returned from ElasticSearch: Article.search 'love', :load => true => Article.find [1, 2] Any option other then TrueClass given as `:load` will be passed to the model's `find` method: Article.search 'love', :include => 'comments' => Article.find [1, 2], :include => 'comments' This allows to use Tire (and ElasticSearch) to retrieve batches of records at once, when needed (eg. in export jobs). [Closes #61]
- Loading branch information
Showing
3 changed files
with
111 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters