Skip to content

Commit

Permalink
🧹 Remove date from advanced search
Browse files Browse the repository at this point in the history
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:
  - #100
  - LafayetteCollegeLibraries/spot#143
  • Loading branch information
kirkkwang committed Oct 21, 2023
1 parent 1c5da5c commit 8dab14c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion hydra/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -87,5 +91,4 @@ end
group :development do
gem 'web-console', '~> 3.0'
gem 'spring', '< 4.0.0'
gem 'blacklight_range_limit'
end
4 changes: 2 additions & 2 deletions hydra/app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8dab14c

Please sign in to comment.