Module: BlacklightMoreLikeThis::SolrHelperExtension
- Defined in:
- lib/blacklight_more_like_this/solr_helper_extension.rb
Overview
Meant to be applied on top of Blacklight helpers
Class Method Summary collapse
Instance Method Summary collapse
- #add_solr_mlt_parameters(solr_parameters, user_parameters) ⇒ Object
- #solr_doc_params(*args) ⇒ Object
Class Method Details
.included(some_class) ⇒ Object
4 5 6 |
# File 'lib/blacklight_more_like_this/solr_helper_extension.rb', line 4 def self.included some_class some_class.solr_search_params_logic += [:add_solr_mlt_parameters] end |
Instance Method Details
#add_solr_mlt_parameters(solr_parameters, user_parameters) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/blacklight_more_like_this/solr_helper_extension.rb', line 8 def add_solr_mlt_parameters solr_parameters, user_parameters config = more_like_this_config config ||= {} return unless config['enable_mlt_in_search_results'] or solr_parameters[:id] solr_parameters[:mlt] = true solr_parameters['mlt.count'] = 3 solr_parameters['mlt.mintf'] = 1 config.keys.select { |x| x.to_s =~ /mlt/ }.each do |k| solr_parameters[k] = config[k] end end |
#solr_doc_params(*args) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/blacklight_more_like_this/solr_helper_extension.rb', line 23 def solr_doc_params(*args) config = more_like_this_config config ||= {} solr_parameters = super(*args) add_solr_mlt_parameters(solr_parameters, {}) solr_parameters end |