From 8dab14c58ab9e0874ede9e2531f381682de6a1e4 Mon Sep 17 00:00:00 2001 From: Kirk Wang Date: Sat, 21 Oct 2023 07:17:57 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Remove=20date=20from=20advanced?= =?UTF-8?q?=20search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a known issue with the date facet in advanced search and the common approach is to remove it. This commit will remove the date from the advanced search form and also increase the character limit for the form fields. It was set to 4 but that was only enough for the year and didn't work for a date search like DD/MM/YYYY. Lastly, I moved the gem call for `blacklight_range_limit` out of the development group so it can be used in a deployed environment. Other than those changes, the search seems to be working as expected Ref: - https://github.com/scientist-softserv/west-virginia-university/issues/100 - https://github.com/LafayetteCollegeLibraries/spot/pull/143 --- hydra/Gemfile | 5 ++++- hydra/app/controllers/catalog_controller.rb | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hydra/Gemfile b/hydra/Gemfile index c715a10..224c472 100644 --- a/hydra/Gemfile +++ b/hydra/Gemfile @@ -26,6 +26,10 @@ gem 'bootsnap', '>= 1.1.0', require: false # ===================================================== gem 'blacklight_oai_provider' +# Blacklight Range Limit for date searches +# ===================================================== +gem 'blacklight_range_limit' + # Automatic Import # ===================================================== gem 'whenever', require: false @@ -87,5 +91,4 @@ end group :development do gem 'web-console', '~> 3.0' gem 'spring', '< 4.0.0' - gem 'blacklight_range_limit' end diff --git a/hydra/app/controllers/catalog_controller.rb b/hydra/app/controllers/catalog_controller.rb index 940fddd..b04503b 100644 --- a/hydra/app/controllers/catalog_controller.rb +++ b/hydra/app/controllers/catalog_controller.rb @@ -65,13 +65,13 @@ class CatalogController < ApplicationController config.add_facet_field solr_name('congress', :facetable), label: 'Congress', link_to_search: :coverage_congress_ssi, limit: true, show: true, component: true config.add_facet_field solr_name('contributing_institution', :facetable), label: 'Contributing Institution', link_to_search: :contributing_institution_ssi, limit: true, show: true, component: true config.add_facet_field solr_name('creator', :facetable), label: 'Creator', limit: true, show: true, component: true - config.add_facet_field solr_name('date', :facetable), label: 'Date', limit: true, show: true, component: true, range: { + config.add_facet_field solr_name('date', :facetable), include_in_advanced_search: false, label: 'Date', limit: true, show: true, component: true, range: { facet_field_label: 'Date Range', num_segments: 10, assumed_boundaries: [1100, Time.zone.now.year + 2], segments: false, slider_js: false, - maxlength: 4 + maxlength: 10 } config.add_facet_field solr_name('extent', :facetable), label: 'Extent', limit: true, show: true, component: true config.add_facet_field solr_name('language', :facetable), label: 'Language', limit: true, show: true, component: true