Skip to content

Commit

Permalink
Address paged content fulltext search (#307)
Browse files Browse the repository at this point in the history
* Update composer.lock

* fix tests to account for lack of page items

* update config adding new field to index and filtering page items out of search results

* Update ui_module to include re-indexing hooks

Co-authored-by: Jared Galanis <[email protected]>
  • Loading branch information
jabrah and jaredgalanis authored Mar 23, 2022
1 parent fc85772 commit 6428940
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 22 deletions.
12 changes: 6 additions & 6 deletions codebase/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions codebase/config/sync/language.negotiation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ url:
source: path_prefix
prefixes:
en: ''
'': null
domains:
en: ''
selected_langcode: site_default
Expand Down
6 changes: 6 additions & 0 deletions codebase/config/sync/search_api.index.default_solr_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
- token
- content_translation
- search_api
- idc_ui_module
config:
- field.storage.node.field_abstract
- field.storage.node.field_access_rights
Expand Down Expand Up @@ -708,6 +709,10 @@ field_settings:
dependencies:
config:
- field.storage.node.field_years
idc_reverse_reference_parent_of_page:
label: 'Page metadata'
property_path: idc_reverse_reference_parent_of_page
type: text
langcode:
label: Language
datasource_id: 'entity:node'
Expand Down Expand Up @@ -893,6 +898,7 @@ datasource_settings:
default: true
selected: { }
processor_settings:
add_page_media_to_paged_content: { }
add_url:
weights:
preprocess_index: -30
Expand Down
52 changes: 52 additions & 0 deletions codebase/config/sync/views.view.solr_search_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ dependencies:
- field.storage.node.field_title_language
- field.storage.node.field_years
- search_api.index.default_solr_index
- taxonomy.vocabulary.islandora_models
content:
- 'taxonomy_term:islandora_models:111544e3-2c30-49f4-800e-9ad2ff99cebe'
module:
- controlled_access_terms
- idc_ui_module
Expand Down Expand Up @@ -216,6 +219,52 @@ display:
min_length: null
fields: { }
plugin_id: search_api_fulltext
field_model:
id: field_model
table: search_api_index_default_solr_index
field: field_model
relationship: none
group_type: group
admin_label: ''
operator: not
value:
- 29
group: 1
exposed: false
expose:
operator_id: ''
label: ''
description: ''
use_operator: false
operator: ''
operator_limit_selection: false
operator_list: { }
identifier: ''
required: false
remember: false
multiple: false
remember_roles:
authenticated: authenticated
reduce: false
is_grouped: false
group_info:
label: ''
description: ''
identifier: ''
optional: true
widget: select
multiple: false
remember: false
default_group: All
default_group_multiple: { }
group_items: { }
reduce_duplicates: false
type: textfield
limit: true
vid: islandora_models
hierarchy: false
error_message: true
plugin_id: search_api_term
sorts:
type:
id: type
Expand Down Expand Up @@ -1194,6 +1243,7 @@ display:
- url.query_args
- 'url.query_args:sort_by'
- 'url.query_args:sort_order'
- user
- 'user.node_grants:view'
cacheable: false
max-age: -1
Expand Down Expand Up @@ -1257,6 +1307,7 @@ display:
- url.query_args
- 'url.query_args:sort_by'
- 'url.query_args:sort_order'
- user
- 'user.node_grants:view'
cacheable: false
max-age: -1
Expand Down Expand Up @@ -5611,6 +5662,7 @@ display:
- url.query_args
- 'url.query_args:sort_by'
- 'url.query_args:sort_order'
- user
- 'user.node_grants:view'
tags:
- 'config:field.storage.node.field_abstract'
Expand Down
20 changes: 10 additions & 10 deletions end-to-end/tests/ui/advanced-search.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ test('Proximity search and Clear button', async (t) => {
.typeText(term1.proxyTerm.range, '3')
.typeText(term1.proxyTerm.termB, 'item', { paste: true })
.click(Page.submitBtn)
.expect(Page.results.count).eql(3);
.expect(Page.results.count).eql(1);

await t.click(Page.addTermBtn);

Expand All @@ -39,12 +39,12 @@ test('Proximity search and Clear button', async (t) => {
.typeText(term2.proxyTerm.range, '3')
.typeText(term2.proxyTerm.termB, 'content', { paste: true })
.click(Page.submitBtn)
.expect(Page.results.count).eql(1);
.expect(Page.results.count).eql(0);

await t
.click(term2.removeBtn)
.click(Page.submitBtn)
.expect(Page.results.count).eql(3);
.expect(Page.results.count).eql(1);

await t
.click(Page.clearTerms)
Expand Down Expand Up @@ -82,7 +82,7 @@ test('Normal search', async (t) => {
.expect(term2.nonproxyTerm.field.value).eql('')
.typeText(term2.nonproxyTerm.term, 'page', { paste: true })
.click(Page.submitBtn)
.expect(Page.results.count).eql(5);
.expect(Page.results.count).eql(3);
});

test('Can initiate search with Enter key', async (t) => {
Expand All @@ -104,8 +104,8 @@ test('Collection filter', async (t) => {
await pager.goToPage(3);

await t
.expect(Page.results.count).eql(4)
.expect(pager.pager.withText('24 of 24 items').exists).ok();
.expect(Page.results.count).eql(2)
.expect(pager.pager.withText('22 of 22 items').exists).ok();

await t
.click(Page.collectionsFilter.toggle) // Closed by default, need to open it first
Expand Down Expand Up @@ -139,13 +139,13 @@ test('Date filter and basic search', async (t) => {
await t
.typeText(term.nonproxyTerm.term, 'item', { paste: true})
.click(Page.submitBtn)
.expect(Page.results.count).eql(7)
.expect(Page.results.count).eql(5)
.typeText(Page.dateInput1, '2000', { paste: true})
.pressKey('enter')
.expect(Page.results.count).eql(2)
.typeText(Page.dateInput2, '2010', { paste: true})
.pressKey('tab')
.expect(Page.results.count).eql(5)
.expect(Page.results.count).eql(3)
.click(Page.clearTerms)
.expect(Page.results.count).eql(10);
});
Expand All @@ -158,8 +158,8 @@ test('Date filter will reset current page', async (t) => {
await t.expect(Page.results.count).eql(10);
await pager.goToPage(3);
await t
.expect(Page.results.count).eql(4)
.expect(pager.pager.withText('24 of 24 items').exists).ok();
.expect(Page.results.count).eql(2)
.expect(pager.pager.withText('22 of 22 items').exists).ok();

await t
.typeText(Page.dateInput1, '2000', { paste: true })
Expand Down
10 changes: 4 additions & 6 deletions end-to-end/tests/ui/search-page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ test('Returns all items by default', async (t) => {

await t
.expect(Page.titleBar.withText('Search Results').exists).ok()
.expect(pager.pager.withText('of 24 items').exists).ok()
.expect(pager.pager.withText('of 22 items').exists).ok()
.expect(pager.buttons.count).eql(5);
});

Expand All @@ -24,9 +24,7 @@ test('Entering a new search term resets current page', async (t) => {
.typeText(Page.searchInput, 'moo', { paste: true })
.click(Page.searchSubmit)
.expect(Page.results.count).eql(10)
.expect(pager.buttons.withText('2').exists).ok()
.click(pager.buttons.withText('2'))
.expect(Page.results.count).eql(2)
.expect(pager.buttons.withText('2').exists).notOk()
// Second search for 'animal'
.typeText(Page.searchInput, 'animal', { paste: true, replace: true })
.click(Page.searchSubmit)
Expand Down Expand Up @@ -54,6 +52,6 @@ test('Selecting or deselecting a facet resets current page', async (t) => {
// param were set to anything other than the first page, then no results
// would be shown
await t
.expect(pager.pager.withText('10 of 10 items').exists).ok()
.expect(Page.results.count).eql(10);
.expect(pager.pager.withText('8 of 8 items').exists).ok()
.expect(Page.results.count).eql(8);
});

0 comments on commit 6428940

Please sign in to comment.