Class: BrowseLevelEvaluationService

Inherits:
Object
  • Object
show all
Defined in:
app/services/browse_level_evaluation_service.rb

Overview

Purpose: To walk the browse levels until we reach the current browse level. While walking the browse levels, determine which FacetItems to attach at each level.

That is to say, each browse level’s “values” are lazily evaluated.

There is a complicated negotation of the Exhibit, Collection, BrowseLevel, and query params.

TODO: Should this class be implemented as a delegate of the

ApplicationController class. I am passing in three anonymous functions that
could instead be deferred to the calling context.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(solr_search_params_callable, get_search_results_callable, facet_in_params_callable, collection, exhibit, params) ⇒ BrowseLevelEvaluationService

Returns a new instance of BrowseLevelEvaluationService.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/services/browse_level_evaluation_service.rb', line 22

def initialize(
    solr_search_params_callable,
    get_search_results_callable,
    facet_in_params_callable,
    collection,
    exhibit,
    params
  )
  @solr_search_params_callable = solr_search_params_callable
  @get_search_results_callable = get_search_results_callable
  @facet_in_params_callable = facet_in_params_callable
  @collection = collection
  @exhibit = exhibit
  @params = ParamsAdaptorForFilter.new(params)
end

Instance Attribute Details

#exhibitObject (readonly)

Returns the value of attribute exhibit.



14
15
16
# File 'app/services/browse_level_evaluation_service.rb', line 14

def exhibit
  @exhibit
end

#extra_controller_paramsObject (readonly)

Returns the value of attribute extra_controller_params.



14
15
16
# File 'app/services/browse_level_evaluation_service.rb', line 14

def extra_controller_params
  @extra_controller_params
end

#get_search_results_callableObject (readonly)

Returns the value of attribute get_search_results_callable.



14
15
16
# File 'app/services/browse_level_evaluation_service.rb', line 14

def get_search_results_callable
  @get_search_results_callable
end

#paramsObject (readonly)

Returns the value of attribute params.



14
15
16
# File 'app/services/browse_level_evaluation_service.rb', line 14

def params
  @params
end

#solr_search_params_callableObject (readonly)

Returns the value of attribute solr_search_params_callable.



14
15
16
# File 'app/services/browse_level_evaluation_service.rb', line 14

def solr_search_params_callable
  @solr_search_params_callable
end

Instance Method Details

#extract(browse_levels) ⇒ Object



38
39
40
# File 'app/services/browse_level_evaluation_service.rb', line 38

def extract(browse_levels)
  recursive_extract(browse_levels,true)
end