-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show Hyrax::PcdmCollection resources in search results #5515
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
app/views/catalog/_index_header_list_hyrax_pcdm_collection.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<div class="search-results-title-row"> | ||
<h3 class="search-result-title"><%= link_to document.title_or_label, [hyrax, document] %></h3> | ||
<%= Hyrax::CollectionPresenter.new(document, current_ability).collection_type_badge %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# frozen_string_literal: true | ||
RSpec.describe 'searching', index_adapter: :solr_index do | ||
let(:user) { create :user } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First fully valkyrie feature test. 💯 |
||
let(:subject_value) { 'mustache' } | ||
let!(:work) do | ||
FactoryBot.valkyrie_create(:monograph, :public, | ||
title: ["Toothbrush"], | ||
keyword: [subject_value, 'taco']) | ||
end | ||
|
||
let!(:collection) do | ||
FactoryBot.valkyrie_create(:hyrax_collection, :public, title: ['collection title abc'], description: [subject_value], members: [work]) | ||
end | ||
|
||
before { allow(Hyrax.config).to receive(:collection_model).and_return('Hyrax::PcdmCollection') } | ||
|
||
context "as a public user", :clean_repo do | ||
it "using the gallery view" do | ||
visit '/' | ||
fill_in "search-field-header", with: "Toothbrush" | ||
click_button "search-submit-header" | ||
expect(page).to have_content "1 entry found" | ||
within "#search-results" do | ||
expect(page).to have_content "Toothbrush" | ||
end | ||
|
||
click_link "Gallery" | ||
expect(page).to have_content "Filtering by: Toothbrush" | ||
within "#documents" do | ||
expect(page).to have_content "Toothbrush" | ||
end | ||
end | ||
|
||
it "only searches all and does not display search options for dashboard files" do | ||
visit '/' | ||
|
||
# it "does not display search options for dashboard files" do | ||
# This section was tested on its own, and required a full setup. | ||
within(".input-group-btn") do | ||
expect(page).not_to have_content("All") | ||
expect(page).not_to have_content("My Works") | ||
expect(page).not_to have_content("My Collections") | ||
expect(page).not_to have_content("My Shares") | ||
end | ||
|
||
expect(page).not_to have_css("a[data-search-label*=All]", visible: false) | ||
expect(page).not_to have_css("a[data-search-label*='My Works']", visible: false) | ||
expect(page).not_to have_css("a[data-search-label*='My Collections']", visible: false) | ||
expect(page).not_to have_css("a[data-search-label*='My Highlights']", visible: false) | ||
expect(page).not_to have_css("a[data-search-label*='My Shares']", visible: false) | ||
|
||
fill_in "search-field-header", with: subject_value | ||
click_button("Go") | ||
expect(page).to have_content('Search Results') | ||
expect(page).to have_content "Toothbrush" | ||
expect(page).to have_content('collection title abc') | ||
expect(page).to have_selector("//img") | ||
|
||
expect(page.body).to include "<span itemprop=\"keywords\"><a href=\"/catalog?f%5Bkeyword_sim%5D%5B%5D=taco&locale=en\">taco</a></span>" | ||
expect(page.body).to include "<span itemprop=\"keywords\"><a href=\"/catalog?f%5Bkeyword_sim%5D%5B%5D=mustache&locale=en\">mustache</a></span>" | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -303,6 +303,14 @@ def clean_active_fedora_repository | |
Valkyrie::IndexingAdapter.find(adapter_name).wipe! | ||
end | ||
|
||
# Configure blacklight to use the valkyrie solr index | ||
config.around(:example, index_adapter: :solr_index) do |example| | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice to have this in place. It will help with future tests that need the valkyrie core to be primary. |
||
blacklight_connection_url = CatalogController.blacklight_config.connection_config[:url] | ||
CatalogController.blacklight_config.connection_config[:url] = Valkyrie::IndexingAdapter.find(:solr_index).connection.options[:url] | ||
example.run | ||
CatalogController.blacklight_config.connection_config[:url] = blacklight_connection_url | ||
end | ||
|
||
config.before(:example, :valkyrie_adapter) do |example| | ||
adapter_name = example.metadata[:valkyrie_adapter] | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have the string version as well? It is pretty common to include both, but the string stores as the exact string typically used for exact matching. I don't imagine that someone would be looking for an exact match for the entire description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can tell description was only every indexed as
_tesim
. (https://github.com/samvera/hyrax/blob/main/app/indexers/hyrax/basic_metadata_indexer.rb#L7)