projectblacklight / blacklight

Blacklight provides a discovery interface for any Solr (http://lucene.apache.org/solr) index.
http://projectblacklight.org/
Other
757 stars 257 forks source link

Pass spellcheck.q to solr for JSON DSL queries too #3065

Closed sandbergja closed 4 months ago

sandbergja commented 1 year ago

Closes #3064

marlo-longley commented 4 months ago

@sandbergja Hello! Thanks for submitting this fix. My team is working on the next release and would like to include this work but it needs a rebase. If we're reading this right, the rebased method would look something like:

    def add_search_field_with_json_query_parameters(solr_parameters)
      return unless search_state.query_param

      bool_query = search_field.clause_params.transform_values { |v| v.merge(query: search_state.query_param) }
      solr_parameters["spellcheck.q"] ||= search_state.query_param

      solr_parameters.append_boolean_query(:must, bool_query)
    end

Would you want to submit the right change? If not we are happy to contribute a small fixup commit. Thanks.

sandbergja commented 4 months ago

@marlo-longley thanks for dusting this one off, and for the rebase assist! I've force pushed your suggested rebase to the same branch.