Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UnstemSolrParams
# lib/unstem_solr_params.rb
# Add on to CatalogController or another SolrHelper
#, to support :unstem_search param to search only un-stemmed fields.
module UnstemSolrParams
def self.included(klass)
# Replace :add_query_to_solr in solr_search_params_logic with
# our new method.
i = klass.solr_search_params_logic << :add_unstemmed_overrides_to_solr
end
##
# If unstemmed_search is selected, then we add params to redefine
# things like $author_qf, $title_qf, etc.. Normally those are supplied
# by Solr solrconfig.xml defaults, but we define em explicitly in the
# request to contain only unstemmed fields.
def add_unstemmed_overrides_to_solr(solr_parameters, user_parameters)
if user_parameters[:unstemmed_search]
Blacklight.config[:unstemmed_overrides].each_pair do |key, value|
solr_parameters[key] = value
end
end
return solr_parameters
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.