Module: BlacklightCql::SolrHelperExtension

Extended by:
ActiveSupport::Concern
Defined in:
lib/blacklight_cql/solr_helper_extension.rb

Overview

We over-ride methods on CatalogController simply by include’ing this module into CatalogController, which this plugins setup will do.

This works ONLY becuase the methods we’re over-riding come from a module themsleves (SolrHelper) – if they were defined on CatalogController itself, it would not, and we’d have to use some ugly monkey patching alias_method_chain instead, thankfully we do not.

Instance Method Summary collapse

Instance Method Details

#cql_to_solr_search_params(solr_params = {}, user_params = {}) ⇒ Object

Over-ride solr_search_params to do special CQL-to-complex-solr-query processing iff the “search_field” is our pseudo-search-field indicating a CQL query.



23
24
25
26
27
28
29
# File 'lib/blacklight_cql/solr_helper_extension.rb', line 23

def cql_to_solr_search_params(solr_params ={}, user_params ={})
  if user_params["search_field"] == self.pseudo_search_field[:key] && ! params["q"].blank?
    parser = CqlRuby::CqlParser.new
    solr_params[:q] = "{!lucene} " + parser.parse( params["q"] ).to_bl_solr(blacklight_config)     
  end
  return solr_params
end