projectblacklight / blacklight_advanced_search

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

run filter values through #facet_display_value so that query facets display correctly #71

Open codeforkjeff opened 7 years ago

codeforkjeff commented 7 years ago

This PR fixes the following issue: if you have a facet field defined as follows:

    config.add_facet_field 'example_query_facet_field', label: 'Publish Date', :query => {
       :years_5 => { label: 'within 5 Years', fq: "pub_date_isort:[#{Time.zone.now.year - 5 } TO *]" },
       :years_10 => { label: 'within 10 Years', fq: "pub_date_isort:[#{Time.zone.now.year - 10 } TO *]" },
       :years_25 => { label: 'within 25 Years', fq: "pub_date_isort:[#{Time.zone.now.year - 25 } TO *]" }
    }

and you filter on it on the advanced search page, the value displayed in the constraints box is "years_5" instead of "within 5 Years."

This PR runs the values through #facet_display_value just like core Blacklight does.