Skip to content

Commit

Permalink
This fixes advanced search. When I added blacklight_advanced_search
Browse files Browse the repository at this point in the history
…, I added the

`SearchBuilder` class from the previous version of MIRA. It seems that the `SearchBuilder`
class was conflicting with those classes in Hyrax. When I removed them, advanced search
functionality returned. This commit deletes those classe and removes refs to them in the
catalog controller. I also updated the feature spec to make sure that results being
returned by advanced search are correct. This also includes a search spec that I wrote
to make sure that non-advanced search is returning correct results as well.

Closes #578
  • Loading branch information
little9 committed Nov 24, 2017
1 parent 8a63bc8 commit b73d951
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 28 deletions.
2 changes: 0 additions & 2 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def self.modified_field
configure_blacklight do |config|
# default advanced config values
config.advanced_search ||= Blacklight::OpenStructWithHashAccess.new
# config.advanced_search[:qt] ||= 'advanced'
config.advanced_search[:url_key] ||= 'advanced'
config.advanced_search[:query_parser] ||= 'dismax'
config.advanced_search[:form_solr_parameters] ||= {}
Expand All @@ -27,7 +26,6 @@ def self.modified_field

config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
config.show.partials.insert(1, :openseadragon)
config.search_builder_class = TuftsCatalogSearchBuilder

# Show gallery view
config.view.gallery.partials = [:index_header, :index]
Expand Down
6 changes: 1 addition & 5 deletions app/controllers/hyrax/my/works_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ module Hyrax
module My
class WorksController < MyController
# Search builder for a list of works that belong to me
# Override of Blacklight::RequestBuilders
def search_builder_class
TuftsMyWorksSearchBuilder
end

# Override of Blacklight::RequestBuilder
def index
add_breadcrumb t(:'hyrax.controls.home'), root_path
add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
Expand Down
10 changes: 0 additions & 10 deletions app/search_builders/tufts_catalog_search_builder.rb

This file was deleted.

8 changes: 0 additions & 8 deletions app/search_builders/tufts_my_works_search_builder.rb

This file was deleted.

8 changes: 5 additions & 3 deletions spec/features/advanced_search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@

RSpec.feature 'perform an advanced search', :clean do
let(:pdf) { FactoryGirl.create(:pdf) }
let(:another_pdf) { FactoryGirl.create(:populated_pdf) }
let(:user) { FactoryGirl.create(:admin) }

before { login_as user }

scenario do
scenario 'performing a basic search on the advanced search page' do
visit '/advanced'
expect(page).to have_content('More Search Options')
fill_in 'Creator', with: pdf.creator
fill_in 'Title', with: pdf.title[0]
click_on 'Search'
expect(page).to have_content(pdf.id)
expect(page).to have_content(pdf.title[0])
expect(page).not_to have_content(another_pdf.title[0])
end
end
26 changes: 26 additions & 0 deletions spec/features/search_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'rails_helper'
include Warden::Test::Helpers

RSpec.feature 'perform an advanced search', :clean do
let(:pdf) { FactoryGirl.create(:pdf) }
let(:another_pdf) { FactoryGirl.create(:populated_pdf) }
let(:user) { FactoryGirl.create(:admin) }

before { login_as user }

scenario 'performing a basic search to find the first pdf' do
visit '/dashboard'
fill_in 'search-field-header', with: pdf.title[0]
click_on 'Go'
expect(page).to have_selector('.blacklight-pdf')
expect(page).to have_content(pdf.title[0])
end

scenario 'performing a basic search to find the second pdf' do
visit '/dashboard'
fill_in 'search-field-header', with: another_pdf.title[0]
click_on 'Go'
expect(page).to have_selector('.blacklight-pdf')
expect(page).to have_content(another_pdf.title[0])
end
end

0 comments on commit b73d951

Please sign in to comment.