Skip to content

Commit

Permalink
enable fulltext search on the Carnegie custom site (DLC-1140)
Browse files Browse the repository at this point in the history
  • Loading branch information
barmintor committed Jul 23, 2024
1 parent 8215f99 commit 67c286b
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/carnegie/centennial_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CentennialController < SubsitesController
layout 'signature'

configure_blacklight do |config|
Dcv::Configurators::CarnegieBlacklightConfigurator.configure(config)
Dcv::Configurators::CarnegieBlacklightConfigurator.configure(config, fulltext: false)
config.show.route = { controller: 'carnegie/centennial' }

# Include this target's content in search results, and any additional publish targets specified in subsites.yml
Expand Down
3 changes: 2 additions & 1 deletion lib/dcv/configurators/carnegie_blacklight_configurator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class Dcv::Configurators::CarnegieBlacklightConfigurator

extend Dcv::Configurators::BaseBlacklightConfigurator

def self.configure(config)
def self.configure(config, fulltext: true)

config.show.route = { controller: 'carnegie' }

Expand Down Expand Up @@ -109,6 +109,7 @@ def self.configure(config)
configure_keyword_search_field(config)
configure_title_search_field(config)
configure_name_search_field(config)
configure_fulltext_search_field(config, default: false) if fulltext

# "sort results by" select (pulldown)
# label in pulldown is followed by the name of the SOLR field to sort by and
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true
require 'rails_helper'

describe Dcv::Configurators::CarnegieBlacklightConfigurator do
let(:config) do
Blacklight::Configuration.new
end
let(:configurator) { Class.new { include Dcv::Configurators::BaseBlacklightConfigurator }.new }

describe 'fulltext search configuration' do
context 'flag is default' do
before do
described_class.configure(config)
end

it 'only includes the field values in facet.field' do
expect(config.search_fields['fulltext_tesim']).to be_a Blacklight::Configuration::SearchField
end
end
context 'flag is true' do
before do
described_class.configure(config, fulltext: true)
end

it 'only includes the field values in facet.field' do
expect(config.search_fields['fulltext_tesim']).to be_a Blacklight::Configuration::SearchField
end
end
context 'flag is false, as per centennial site' do
before do
described_class.configure(config, fulltext: false)
end

it 'only includes the field values in facet.field' do
expect(config.search_fields['fulltext_tesim']).to be_nil
end
end
end
end

0 comments on commit 67c286b

Please sign in to comment.