Skip to content

Commit

Permalink
WIP temp spotlight updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rawOrlando committed Jan 9, 2024
1 parent 32ee565 commit 8125aa8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ gem 'blacklight', '7.35.0'
# First verison v3.4.0 that supports Rails 7
# https://github.com/projectblacklight/spotlight/releases
# First version v3.0.0 to supports Rails 6
# later versions won't use sir_trevor e.i. 3.4
gem 'blacklight-spotlight', tag: 'v3.4.4', git: 'https://github.com/projectblacklight/spotlight.git'
# gem 'blacklight-spotlight', tag: 'v3.5.0', git: 'https://github.com/projectblacklight/spotlight.git'
gem 'rsolr' # , '>= 1.0'
Expand Down Expand Up @@ -89,7 +90,8 @@ group :test do
gem 'capybara-screenshot'
gem 'database_cleaner'
gem 'factory_bot_rails'
gem 'selenium-webdriver', '~> 4.1.0'
# temp try a newer version was 4.1 (latest 4.4)
gem 'selenium-webdriver', '~> 4.4.0'
gem 'simplecov'
gem 'simplecov-lcov', '~> 0.8.0'
gem 'webdrivers' # temp, '~> 4.0', require: false
Expand Down
14 changes: 8 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ GEM
net-imap (0.4.9)
date
net-protocol
net-ldap (0.18.0)
net-ldap (0.19.0)
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
Expand Down Expand Up @@ -386,7 +386,7 @@ GEM
racc
popper_js (1.16.1)
public_suffix (5.0.4)
puma (6.4.0)
puma (6.4.1)
nio4r (~> 2.0)
racc (1.7.3)
rack (2.2.8)
Expand Down Expand Up @@ -507,10 +507,11 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
selenium-webdriver (4.1.0)
selenium-webdriver (4.4.0)
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
signet (0.18.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
Expand Down Expand Up @@ -574,7 +575,7 @@ GEM
underscore-rails (1.8.3)
unicode-display_width (2.5.0)
version_gem (1.1.3)
view_component (3.8.0)
view_component (3.9.0)
activesupport (>= 5.2.0, < 8.0)
concurrent-ruby (~> 1.0)
method_source (~> 1.0)
Expand All @@ -590,6 +591,7 @@ GEM
rubyzip (>= 1.3.0)
selenium-webdriver (~> 4.0, < 4.11)
webrick (1.8.1)
websocket (1.2.10)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand Down Expand Up @@ -636,7 +638,7 @@ DEPENDENCIES
rubocop
sass-rails
sassc-rails (~> 2.1)
selenium-webdriver (~> 4.1.0)
selenium-webdriver (~> 4.4.0)
simplecov
simplecov-lcov (~> 0.8.0)
sitemap_generator
Expand Down
1 change: 1 addition & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link application.js
3 changes: 2 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class ApplicationController < ActionController::Base
include Blacklight::Controller
include Spotlight::Controller

layout 'blacklight'
layout :determine_layout if respond_to? :layout
# layout 'blacklight'

# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
Expand Down
9 changes: 7 additions & 2 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Simplified catalog controller
class CatalogController < ApplicationController
include Blacklight::Catalog
include Blacklight::DefaultComponentConfiguration

configure_blacklight do |config|
config.show.oembed_field = :oembed_url_ssm
Expand Down Expand Up @@ -47,9 +48,9 @@ class CatalogController < ApplicationController
config.add_show_field('citation_tesim', label: 'Citation')
config.add_show_field('permanent_url_tesim', label: 'Permanent URL', helper_method: 'make_this_a_link')

config.add_search_field 'all_fields', label: 'Everything'
config.add_search_field 'all_fields', label: I18n.t('spotlight.search.fields.search.all_fields') #'Everything'

config.add_sort_field 'relevance', sort: 'score desc', label: 'Relevance'
config.add_sort_field 'relevance', sort: 'score desc', label: I18n.t('spotlight.search.fields.sort.relevance') #'Relevance'

config.add_field_configuration_to_solr_request!

Expand Down Expand Up @@ -79,5 +80,9 @@ class CatalogController < ApplicationController

config.add_nav_action(:bookmark, partial: 'blacklight/nav/bookmark', if: :render_bookmarks_control?)
config.add_nav_action(:search_history, partial: 'blacklight/nav/search_history')

# enable facets:
# https://github.com/projectblacklight/spotlight/issues/1812#issuecomment-327345318
config.add_facet_fields_to_solr_request!
end
end

0 comments on commit 8125aa8

Please sign in to comment.