projectblacklight / blacklight_advanced_search

Advanced search plugin for Blacklight
http://projectblacklight.org
Other
24 stars 25 forks source link

allow users to submit simple keyword with inclusive facets #60

Closed tampakis closed 7 years ago

tampakis commented 8 years ago

When advanced facet limits are applied (with no advanced query), adding a simple keyword search does nothing to affect the search results. This is because the search query gets overriden by a blank advanced query. This PR adjusts the behavior so that the solr query gets replaced only when an advanced query is submitted. Example query where simple keyword not factored in results.

tampakis commented 8 years ago

Can someone merge this and cut a new gem release? Also @cbeer may I be added as a projectblacklight contributor?

cbeer commented 8 years ago

Or, what about just ensuring we don't overwrite the user's q parameter when generating the query? Maybe something (a little better than this...) that includes it in the generated query string:

module BlacklightAdvancedSearch::ParsingNestingParser
    def process_query(params, config)
    queries = ([{ params[:search_field] => params[:q] }] + keyword_queries).map do |field, query|
      ParsingNesting::Tree.parse(query, config.advanced_search[:query_parser]).to_query(local_param_hash(field, config))
    end
    queries.join(" #{keyword_op} ")
  end
tampakis commented 8 years ago

I like that idea. I'll rework the PR.