diff --git a/config/routes.rb b/config/routes.rb
index 925fbcf5..9a4759a8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,6 +9,8 @@
end
mount Blacklight::Engine => '/'
+ mount BlacklightAdvancedSearch::Engine => '/'
+
root to: "catalog#index"
concern :searchable, Blacklight::Routes::Searchable.new
diff --git a/spec/controllers/catalog_controller_spec.rb b/spec/controllers/catalog_controller_spec.rb
index ad7e364d..d1e7b513 100644
--- a/spec/controllers/catalog_controller_spec.rb
+++ b/spec/controllers/catalog_controller_spec.rb
@@ -12,7 +12,7 @@
let(:search_fields) { controller.blacklight_config.search_fields.keys }
let(:expected_search_fields) do
- ['all_fields', 'author_tesim', 'orbisBibId_ssi', 'subjectName_ssim', 'title_tesim']
+ ['all_fields', 'all_fields_advanced', 'author_tesim', 'identifierShelfMark_tesim', 'oid_ssi', 'orbisBibId_ssi', 'subjectName_ssim', 'title_tesim']
end
it { expect(search_fields).to contain_exactly(*expected_search_fields) }
diff --git a/spec/support/solr_documents/advanced_search_testing_only.rb b/spec/support/solr_documents/advanced_search_testing_only.rb
new file mode 100644
index 00000000..5900f957
--- /dev/null
+++ b/spec/support/solr_documents/advanced_search_testing_only.rb
@@ -0,0 +1,157 @@
+# frozen_string_literal: true
+ADVANCED_SEARCH_TESTING_1 = {
+ "id": "1",
+ "abstract_tesim": ["Incomplete at beginning and end.",
+ "The tale of Sindbād and his princely pupil, in colloquial Arabic."],
+ "author_ssim": ["Me and Frederick"],
+ "author_tesim": ["Me and Frederick"],
+ "alternativeTitle_tesim": ["Book of Sindbad.",
+ "Sindbad the sailor"],
+ "collectionId_ssim": ["1"],
+ "collectionId_tesim": ["1"],
+ "contents_tesim": ["A few leaves supplied in a later hand.",
+ "Fair modern (18th century?) naskhī, in red and black.",
+ "Islamic binding, paper covered, with flap."],
+ "date_ssim": ["[17--?]"],
+ "dateStructured_ssim": ["1700-00-00T00:00:00Z"],
+ "dependentUris_ssim": ["/ladybird/oid/11607445"],
+ "description_tesim": ["A few leaves supplied in a later hand.",
+ "Fair modern (18th century?) naskhī, in red and black.",
+ "Islamic binding, paper covered, with flap."],
+ "extent_ssim": ["81 leaves ; 20.5 x 14.5 cm."],
+ "extentOfDigitization_ssim": ["Complete work digitized."],
+ "format": ["mixed material"],
+ "identifierShelfMark_ssim": ["Landberg MSS 596"],
+ "identifierShelfMark_tesim": ["Landberg MSS 596"],
+ "imageCount_isi": 85,
+ "indexedBy_tsim": ["Brockelmann, S I, pp. 237, 239, 252."],
+ "oid_ssi": "11607445",
+ "orbisBibId_ssi": "3832098",
+ "partOf_tesim": ["Beinecke Library"],
+ "partOf_ssim": ["Beinecke Library"],
+ "public_bsi": true,
+ "recordType_ssi": "oid",
+ "references_tesim": ["Brockelmann, S I, pp. 237, 239, 252."],
+ "repository_ssim": ["Beinecke Library"],
+ "rights_ssim": ["The use of this image may be subject to the copyright law of the United States (Title 17, United States Code) or to site license or other rights management terms and conditions. The person using the image is liable for any infringement."],
+ "rights_tesim": ["The use of this image may be subject to the copyright law of the United States (Title 17, United States Code) or to site license or other rights management terms and conditions. The person using the image is liable for any infringement."],
+ "source_ssim": ["ladybird"],
+ "subjectEra_ssim": ["Islamic binding"],
+ "subjectTitle_tsim": ["Islamic binding"],
+ "subjectTitleDisplay_tsim": ["Arabic language and literature--Belles lettres",
+ "Islamic binding"],
+ "subjectName_ssim": ["Computer Science"],
+ "subjectName_tesim": ["Computer Science"],
+ "subjectTopic_tesim": ["Arabic language and literature--Belles lettres",
+ "Islamic binding"],
+ "subjectTopic_ssim": ["Arabic language and literature--Belles lettres",
+ "Islamic binding"],
+ "title_tesim": ["Record 1"],
+ "uri_ssim": ["/ladybird/oid/11607445"],
+ "visibility_ssi": "Public",
+ "abstract_ssim": ["Incomplete at beginning and end.",
+ "The tale of Sindbād and his princely pupil, in colloquial Arabic."],
+ "alternativeTitle_ssim": ["Book of Sindbad.",
+ "Sindbad the sailor"],
+ "date_tsim": ["[17--?]"],
+ "oid_ssim": ["11607445"],
+ "orbisBibId_ssim": ["3832098"],
+ "recordType_ssim": ["oid"],
+ "references_ssim": ["Brockelmann, S I, pp. 237, 239, 252."],
+ "subject_topic_tsim": ["Arabic language and literature--Belles lettres",
+ "Islamic binding"],
+ "title_tsim": ["Record 1"]
+}.freeze
+
+ADVANCED_SEARCH_TESTING_2 = {
+ "id": "2",
+ "abstract_tesim": ["Manuscript on parchment of Jacopo Zeno, Vita Caroli Zeni. With a dedicatory preface to Pope Pius II. This manuscript is of special importance because it contains the complete work."],
+ "author_ssim": ["Zeno, Jacopo, 1417-1481"],
+ "author_tesim": ["Zeno, Jacopo, 1417-1481"],
+ "collectionId_ssim": ["1"],
+ "collectionId_tesim": ["1"],
+ "contents_tesim": ["Binding: Eighteenth century. Brownish-red goatskin, gold-tooled; pale green and gold, Dutch gilt paper boards.",
+ "On f. 1r, a foliage border which includes hares, stork, vase, and arms of the Piccolomini family (argent, a cross azur with 5 crescents or; surmounted by keys in saltire argent and a papal tiara; supported by a pair of angels). Eleven elaborate initials, 11- to 7-line, in gold, red, blue, and green entwined with foliage. The style of decoration is decidedly Roman.",
+ "Purchased by William Loring Andrews who presented it to Yale in 1894.",
+ "Script: Written in humanistic script by Franciscus de Tianis of Pistoia."],
+ "contributor_tsim": ["Zeno, Carlo,--1334-1418",
+ "Zeno, Jacopo,--1417-1481"],
+ "contributorDisplay_tsim": ["Zeno, Carlo,--1334-1418",
+ "Zeno, Jacopo,--1417-1481"],
+ "creatorDisplay_tsim": ["Zeno, Jacopo, 1417-1481"],
+ "date_ssim": ["[ca. 1458]"],
+ "dateStructured_ssim": ["1458-00-00T00:00:00Z"],
+ "dependentUris_ssim": ["/ladybird/oid/11684565"],
+ "description_tesim": ["Binding: Eighteenth century. Brownish-red goatskin, gold-tooled; pale green and gold, Dutch gilt paper boards.",
+ "On f. 1r, a foliage border which includes hares, stork, vase, and arms of the Piccolomini family (argent, a cross azur with 5 crescents or; surmounted by keys in saltire argent and a papal tiara; supported by a pair of angels). Eleven elaborate initials, 11- to 7-line, in gold, red, blue, and green entwined with foliage. The style of decoration is decidedly Roman.",
+ "Purchased by William Loring Andrews who presented it to Yale in 1894.",
+ "Script: Written in humanistic script by Franciscus de Tianis of Pistoia."],
+ "extent_ssim": ["ff. ii + 192 + i : parchment ; 271 x 177 (177 x 106) mm."],
+ "extentOfDigitization_ssim": ["Complete work digitized."],
+ "format": ["mixed material"],
+ "genre_ssim": ["Decorated initials",
+ "Manuscripts"],
+ "identifierShelfMark_ssim": ["Beinecke MS 2"],
+ "identifierShelfMark_tesim": ["Beinecke MS 2"],
+ "imageCount_isi": 398,
+ "indexedBy_tsim": ["Jacopo Zeno, Vita Caroli Zeni. General Collection, Beinecke Rare Book and Manuscript Library, Yale University.",
+ "Shailor, B. Catalogue of Medieval and Renaissance Manuscripts in the Beinecke Rare Book and Manuscript Library, MS 2."],
+ "language_ssim": ["Latin"],
+ "oid_ssi": "11684565",
+ "orbisBarcode_ssi": "39002091594300",
+ "orbisBibId_ssi": "9801995",
+ "partOf_tesim": ["Beinecke Library"],
+ "partOf_ssim": ["Beinecke Library"],
+ "public_bsi": true,
+ "publicationPlace_ssim": ["Italy,"],
+ "publicationPlace_tesim": ["Italy,"],
+ "recordType_ssi": "oid",
+ "references_tesim": ["Jacopo Zeno, Vita Caroli Zeni. General Collection, Beinecke Rare Book and Manuscript Library, Yale University.",
+ "Shailor, B. Catalogue of Medieval and Renaissance Manuscripts in the Beinecke Rare Book and Manuscript Library, MS 2."],
+ "repository_ssim": ["Beinecke Library"],
+ "resourceType_ssim": ["Archives or Manuscripts"],
+ "resourceType_tesim": ["Archives or Manuscripts"],
+ "rights_ssim": ["The use of this image may be subject to the copyright law of the United States (Title 17, United States Code) or to site license or other rights management terms and conditions. The person using the image is liable for any infringement."],
+ "rights_tesim": ["The use of this image may be subject to the copyright law of the United States (Title 17, United States Code) or to site license or other rights management terms and conditions. The person using the image is liable for any infringement."],
+ "source_ssim": ["ladybird"],
+ "subjectEra_ssim": ["Medieval and Renaissance Manuscripts in Beinecke Library"],
+ "subjectTitle_tsim": ["Medieval and Renaissance Manuscripts in Beinecke Library"],
+ "subjectTitleDisplay_tsim": ["Biography--Middle Ages, 500-1500",
+ "Crusades--13th-15th centuries",
+ "Illumination of books and manuscripts, Medieval",
+ "Manuscripts, Medieval--Connecticut--New Haven",
+ "Medieval and Renaissance Manuscripts in Beinecke Library"],
+ "subjectName_ssim": ["Zeno, Carlo,--1334-1418",
+ "Zeno, Jacopo,--1417-1481"],
+ "subjectName_tesim": ["Zeno, Carlo,--1334-1418",
+ "Zeno, Jacopo,--1417-1481"],
+ "subjectTopic_tesim": ["Biography--Middle Ages, 500-1500",
+ "Crusades--13th-15th centuries",
+ "Illumination of books and manuscripts, Medieval",
+ "Manuscripts, Medieval--Connecticut--New Haven",
+ "Medieval and Renaissance Manuscripts in Beinecke Library"],
+ "subjectTopic_ssim": ["Biography--Middle Ages, 500-1500",
+ "Crusades--13th-15th centuries",
+ "Illumination of books and manuscripts, Medieval",
+ "Manuscripts, Medieval--Connecticut--New Haven",
+ "Medieval and Renaissance Manuscripts in Beinecke Library"],
+ "title_tesim": ["Record 2"],
+ "uri_ssim": ["/ladybird/oid/11684565"],
+ "url_suppl_ssim": ["https://pre1600ms.beinecke.library.yale.edu/docs/pre1600.ms002.htm"],
+ "visibility_ssi": "Public",
+ "abstract_ssim": ["Manuscript on parchment of Jacopo Zeno, Vita Caroli Zeni. With a dedicatory preface to Pope Pius II."],
+ "author_tsim": ["Zeno, Jacopo, 1417-1481"],
+ "date_tsim": ["[ca. 1458]"],
+ "oid_ssim": ["11684565"],
+ "orbisBarcode_ssim": ["39002091594300"],
+ "orbisBibId_ssim": ["9801995"],
+ "recordType_ssim": ["oid"],
+ "references_ssim": ["Jacopo Zeno, Vita Caroli Zeni. General Collection, Beinecke Rare Book and Manuscript Library, Yale University.",
+ "Shailor, B. Catalogue of Medieval and Renaissance Manuscripts in the Beinecke Rare Book and Manuscript Library, MS 2."],
+ "subject_topic_tsim": ["Biography--Middle Ages, 500-1500",
+ "Crusades--13th-15th centuries",
+ "Illumination of books and manuscripts, Medieval",
+ "Manuscripts, Medieval--Connecticut--New Haven",
+ "Medieval and Renaissance Manuscripts in Beinecke Library"],
+ "title_tsim": ["Record 2"]
+}.freeze
diff --git a/spec/system/advanced_search_spec.rb b/spec/system/advanced_search_spec.rb
new file mode 100644
index 00000000..c082d7e9
--- /dev/null
+++ b/spec/system/advanced_search_spec.rb
@@ -0,0 +1,83 @@
+# frozen_string_literal: true
+
+require 'rails_helper'
+
+RSpec.describe 'Search the catalog using advanced search', type: :system, js: true, clean: true do
+ before do
+ solr = Blacklight.default_index.connection
+ solr.add([dog, cat])
+ solr.commit
+ end
+
+ let(:dog) { ADVANCED_SEARCH_TESTING_1 }
+
+ let(:cat) { ADVANCED_SEARCH_TESTING_2 }
+
+ it 'gets correct search results from all fields' do
+ visit root_path
+ click_on "More Options"
+ # Search for something
+ fill_in 'all_fields_advanced', with: 'Record 1'
+ click_on 'advanced-search-submit'
+
+ within '#documents' do
+ expect(page).to have_content('Record 1')
+ expect(page).not_to have_content('Record 2')
+ end
+ end
+ it 'gets correct search results from author_tesim' do
+ visit root_path
+ click_on 'More Options'
+ # Search for something
+ fill_in 'author_tesim', with: 'Me and Frederick'
+ click_on 'advanced-search-submit'
+ within '#documents' do
+ expect(page).to have_content('Record 1')
+ expect(page).not_to have_content('Record 2')
+ end
+ end
+ it 'gets correct search results from identifierShelfMark_tesim' do
+ visit root_path
+ click_on 'More Options'
+ # Search for something
+ fill_in 'identifierShelfMark_tesim', with: '["Landberg MSS 596"]'
+ click_on 'advanced-search-submit'
+ within '#documents' do
+ expect(page).to have_content('Record 1')
+ expect(page).not_to have_content('Record 2')
+ end
+ end
+ it 'gets correct search results from orbisBibId_ssi' do
+ visit root_path
+ click_on 'More Options'
+ # Search for something
+ fill_in 'orbisBibId_ssi', with: '3832098'
+ click_on 'advanced-search-submit'
+ within '#documents' do
+ expect(page).to have_content('Record 1')
+ expect(page).not_to have_content('Record 2')
+ end
+ end
+ it 'gets correct search results from title_tesim' do
+ visit root_path
+ click_on 'More Options'
+ # Search for something
+ fill_in 'title_tesim', with: '["Record 1"]'
+ click_on 'advanced-search-submit'
+ within '#documents' do
+ expect(page).to have_content('Record 1')
+ expect(page).not_to have_content('Record 2')
+ end
+ end
+ it 'gets correct search results from oid_ssi' do
+ visit root_path
+ click_on 'More Options'
+ # Search for something
+ fill_in 'oid_ssi', with: '11607445'
+ click_on 'advanced-search-submit'
+ within '#documents' do
+ expect(page).to have_content('Record 1')
+ expect(page).not_to have_content('Record 2')
+ end
+ end
+end
diff --git a/spec/system/search_fields_spec.rb b/spec/system/search_fields_spec.rb
index 08e3fadf..2a19268b 100644
--- a/spec/system/search_fields_spec.rb
+++ b/spec/system/search_fields_spec.rb
@@ -11,7 +11,7 @@
let(:search_fields) { CatalogController.blacklight_config.search_fields.keys }
let(:expected_search_fields) do
- ["all_fields", "author_tesim", "orbisBibId_ssi", "subjectName_ssim", "title_tesim"]
+ ['all_fields', 'all_fields_advanced', 'author_tesim', 'identifierShelfMark_tesim', 'oid_ssi', 'orbisBibId_ssi', 'subjectName_ssim', 'title_tesim']
end
let(:dog) do