|
38 | 38 | let(:objects) { [collection, rocks, clouds] }
|
39 | 39 |
|
40 | 40 | it 'finds collections' do
|
41 |
| - get :index, params: { q: 'rocks' }, xhr: true |
| 41 | + get :index, params: { q: 'rocks', search_field: 'all_fields' }, xhr: true |
42 | 42 | expect(response).to be_successful
|
43 | 43 | doc_list = assigns(:response).documents
|
44 | 44 | expect(doc_list.map(&:id)).to match_array [collection.id, rocks.id]
|
45 | 45 | end
|
46 | 46 | end
|
47 | 47 |
|
48 | 48 | describe 'term search' do
|
49 |
| - let(:objects) { [rocks, clouds] } |
| 49 | + # An attached fileset needs to be present in the index to trigger the |
| 50 | + # {!join} in Hyrax::CatalogSearchBuilder#join_for_works_from_files |
| 51 | + # and ensure it does not interfere with query results |
| 52 | + let(:unrelated) { valkyrie_create(:monograph, :with_one_file_set, title: ['Unrelated'], read_groups: ['public']) } |
| 53 | + let(:objects) { [rocks, clouds, unrelated] } |
50 | 54 |
|
51 | 55 | it 'finds works with the given search term' do
|
52 |
| - get :index, params: { q: 'rocks', owner: 'all' } |
| 56 | + get :index, params: { q: 'rocks', search_field: 'all_fields' } |
53 | 57 | expect(response).to be_successful
|
54 | 58 | expect(response).to render_template('catalog/index')
|
55 | 59 | expect(assigns(:response).documents.map(&:id)).to contain_exactly(rocks.id)
|
|
74 | 78 | let(:objects) { [rocks, clouds] }
|
75 | 79 |
|
76 | 80 | it 'finds matching records' do
|
77 |
| - get :index, params: { q: 'full_textfull_text' } |
| 81 | + get :index, params: { q: 'full_textfull_text', search_field: 'all_fields' } |
78 | 82 | expect(response).to be_successful
|
79 | 83 | expect(response).to render_template('catalog/index')
|
80 | 84 | expect(assigns(:response).documents.map(&:id)).to contain_exactly(clouds.id)
|
|
0 commit comments