Class: Elasticated::Repository::IntelligentSearch
- Includes:
- Configurable
- Defined in:
- lib/elasticated/repository/intelligent_search.rb
Instance Attribute Summary
Attributes inherited from Search
#aggregated, #opts, #query, #repository
Instance Method Summary collapse
-
#best_search_method ⇒ Object
if the query is aggregated and the search strategy is use an scroll-like alternative, we must do a 2-step search process.
- #execute ⇒ Object
Methods included from Configurable
Methods inherited from Search
Constructor Details
This class inherits a constructor from Elasticated::Repository::Search
Instance Method Details
#best_search_method ⇒ Object
if the query is aggregated and the search strategy is use an scroll-like alternative, we must do a 2-step search process
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/elasticated/repository/intelligent_search.rb', line 21 def best_search_method if query.limited? && !query.heavy_for?(repository) SinglePageSearch.new repository, query, aggregated, opts else if query.has_offset? NormalSearch.new repository, query, aggregated, opts else if query.sorted? ScrollSearch.new repository, query, aggregated, opts else ScanScrollSearch.new repository, query, aggregated, opts end end end end |
#execute ⇒ Object
37 38 39 40 41 42 |
# File 'lib/elasticated/repository/intelligent_search.rb', line 37 def execute search_method = best_search_method search_method_name = Helpers.unscoped_class_name search_method.class log.debug "#{search_method_name} selected as best search method for query #{query.build.to_json}" search_method.execute end |