Closed MrDys closed 12 years ago
Original reporter: jrochkind
jrochkind: About to merge this into master, but it will require some refactoring of all our 'offiical' plugins, which I'll also do.
jrochkind: adv search seems to still work, changes were backwards compatible to it. (It's still doing some odd things with "extra_controller_params" that will probably confuse if left there forever).
jrochkind: date range plugin likewise seems to still work, refactor was backwards compatible with it.
jrochkind: And yeah, CQL works too.
CODEBASE-307: refactor of solr_search_params.
Removes "extra_controller_params", instead being more clear about input hash (from blacklight rails app URI query), being mapped to output hash (of params sent in query to Solr).
If you want to add more 'simulated' input params, you can just do that, on the hash passed in as the input:
solr_search_params( params.merge(:new_one => "something"))
If you want to 'force' some output solr params, you can just merge them into the output:
solr_search_params().merge(:defType => "something")
Because of change in signature of method, may not be backwards compatible with local customizations or plugins. However, the actual mapping semantics have not changed, all existing tests still pass.
Additionally, the logic was refactored from giant spaghetti method to individual methods focusing on specific things. And a an design reminiscent of rails 'before_filter' is added to allow you to add and remove such pieces of logic, which will be helpful for implementing plugins and local features cleanly. (Before they had to over-ride solr_search_params and call super, which made things somewhat confusing to debug, and didn't provide as much control over ordering of operations).
An example from the spec: