Class: Blacklight::Configuration::SearchField
- Inherits:
-
Field
- Object
- OpenStruct
- OpenStructWithHashAccess
- Field
- Blacklight::Configuration::SearchField
- Defined in:
- lib/blacklight/configuration/search_field.rb
Instance Attribute Summary collapse
- #include_in_simple_select ⇒ Object
- #qt ⇒ Object
-
#query_builder ⇒ nil, #call
A Proc (or other object responding to #call) that receives as parameters: 1) the search builder, 2) this search field, and 3) the solr_parameters hash.
Attributes inherited from Field
#field, #if, #key, #label, #unless
Instance Method Summary collapse
Methods inherited from Field
#default_label, #display_label
Methods inherited from OpenStructWithHashAccess
#deep_dup, #deep_transform_values, #merge, #merge!, #reverse_merge, #select, #sort_by, #sort_by!, #to_h, #try
Instance Attribute Details
#include_in_simple_select ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/blacklight/configuration/search_field.rb', line 13 def normalize! blacklight_config = nil self.if = include_in_simple_select if self.if.nil? super self.qt ||= blacklight_config.default_solr_params[:qt] if blacklight_config && blacklight_config.default_solr_params self end |
#qt ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/blacklight/configuration/search_field.rb', line 13 def normalize! blacklight_config = nil self.if = include_in_simple_select if self.if.nil? super self.qt ||= blacklight_config.default_solr_params[:qt] if blacklight_config && blacklight_config.default_solr_params self end |
#query_builder ⇒ nil, #call
Returns a Proc (or other object responding to #call) that receives as parameters: 1) the search builder, 2) this search field, and 3) the solr_parameters hash. The Proc returns a string suitable for e.g. Solr’s q parameter, or a 2-element array of the string and a hash of additional parameters to include with the query (i.e. for referenced subqueries); note that implementations are responsible for ensuring the additional parameter keys are unique.
13 14 15 16 17 18 19 20 |
# File 'lib/blacklight/configuration/search_field.rb', line 13 def normalize! blacklight_config = nil self.if = include_in_simple_select if self.if.nil? super self.qt ||= blacklight_config.default_solr_params[:qt] if blacklight_config && blacklight_config.default_solr_params self end |
Instance Method Details
#normalize!(blacklight_config = nil) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/blacklight/configuration/search_field.rb', line 13 def normalize! blacklight_config = nil self.if = include_in_simple_select if self.if.nil? super self.qt ||= blacklight_config.default_solr_params[:qt] if blacklight_config && blacklight_config.default_solr_params self end |
#validate! ⇒ Object
22 23 24 |
# File 'lib/blacklight/configuration/search_field.rb', line 22 def validate! raise ArgumentError, "Must supply a search field key" if key.nil? end |