From 273dc5dc6fe163de053c4fdc6138fab80b0a6b8a Mon Sep 17 00:00:00 2001 From: Askhat_Abishev Date: Tue, 18 Feb 2025 17:09:43 +0500 Subject: [PATCH] MSEARCH-958: Authority search: Add namedEvent, sftNamedEvent, saftNamedEvent to possible search options --- NEWS.md | 1 + src/main/resources/model/authority.json | 24 +++++ .../schemas/dto/authority/authority.yaml | 15 +++- .../search/controller/BrowseAuthorityIT.java | 87 ++++++++++--------- .../search/controller/SearchAuthorityIT.java | 29 ++++++- .../controller/StreamResourceIdsIT.java | 2 +- .../AuthorityEventPreProcessorTest.java | 11 ++- .../samples/authority-sample/authority.json | 3 + 8 files changed, 126 insertions(+), 46 deletions(-) diff --git a/NEWS.md b/NEWS.md index 0c28e0387..4514e74c2 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,6 +18,7 @@ * Call Numbers Browse: Implement Browsing Endpoint for Call-Numbers ([MSEARCH-865](https://folio-org.atlassian.net/browse/MSEARCH-865)) * Call Numbers Browse: Support aliases for callNumberTypeId filters ([MSEARCH-942](https://folio-org.atlassian.net/browse/MSEARCH-942)) * Call Numbers Browse: Support showing instance title in browse results list ([MSEARCH-948](https://folio-org.atlassian.net/browse/MSEARCH-948)) +* Authority search: Add namedEvent, sftNamedEvent, saftNamedEvent to possible search options ([MSEARCH-958](https://folio-org.atlassian.net/browse/MSEARCH-958)) ### Bug fixes * Remove shelving order calculation for local call-number types diff --git a/src/main/resources/model/authority.json b/src/main/resources/model/authority.json index faa82ceda..7dcfeedf0 100644 --- a/src/main/resources/model/authority.json +++ b/src/main/resources/model/authority.json @@ -216,6 +216,30 @@ "headingType": "Uniform Title", "authRefType": "Auth/Ref" }, + "namedEvent": { + "type": "authority", + "index": "standard", + "searchAliases": [ "keyword" ], + "distinctType": "namedEvent", + "headingType": "Named Event", + "authRefType": "Authorized" + }, + "sftNamedEvent": { + "type": "authority", + "index": "standard", + "searchAliases": [ "keyword" ], + "distinctType": "sftNamedEvent", + "headingType": "Named Event", + "authRefType": "Reference" + }, + "saftNamedEvent": { + "type": "authority", + "index": "standard", + "searchAliases": [ "keyword" ], + "distinctType": "saftNamedEvent", + "headingType": "Named Event", + "authRefType": "Auth/Ref" + }, "topicalTerm": { "type": "authority", "index": "standard", diff --git a/src/main/resources/swagger.api/schemas/dto/authority/authority.yaml b/src/main/resources/swagger.api/schemas/dto/authority/authority.yaml index 4423cf421..91158452f 100644 --- a/src/main/resources/swagger.api/schemas/dto/authority/authority.yaml +++ b/src/main/resources/swagger.api/schemas/dto/authority/authority.yaml @@ -118,6 +118,19 @@ properties: items: type: "string" description: "See also from tracing uniform title" + namedEvent: + type: "string" + description: "Heading named event" + sftNamedEvent: + type: "array" + description: "See from tracing named event" + items: + type: "string" + saftNamedEvent: + type: "array" + description: "See also from tracing named event" + items: + type: "string" topicalTerm: type: "string" description: "Heading topical term" @@ -189,4 +202,4 @@ properties: description: "Generated field by mod-search, used to easily identity the heading/reference of the record that provides authority information" numberOfTitles: type: "integer" - description: "Generated field by mod-search, used to count the total number of bib records linked to this authority record" \ No newline at end of file + description: "Generated field by mod-search, used to count the total number of bib records linked to this authority record" diff --git a/src/test/java/org/folio/search/controller/BrowseAuthorityIT.java b/src/test/java/org/folio/search/controller/BrowseAuthorityIT.java index 46774b7d5..8cc946784 100644 --- a/src/test/java/org/folio/search/controller/BrowseAuthorityIT.java +++ b/src/test/java/org/folio/search/controller/BrowseAuthorityIT.java @@ -31,7 +31,7 @@ class BrowseAuthorityIT extends BaseIntegrationTest { @BeforeAll static void prepare() { - setUpTenant(25, authorities()); + setUpTenant(28, authorities()); } @AfterAll @@ -78,7 +78,7 @@ void browseByAuthority_browsingAroundWithDiacritics() { .param("precedingRecordsCount", "2"); var actual = parseResponse(doGet(request), AuthorityBrowseResult.class); assertThat(actual).isEqualTo(new AuthorityBrowseResult() - .totalRecords(17).prev("Harry Potter").next("Ĵämes Röllins test") + .totalRecords(19).prev("Harry Potter").next("Ĵämes Röllins test") .items(List.of( authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), authorityBrowseItem("Ĵämes Röllins", 2, "Personal Name", REFERENCE, null), @@ -94,7 +94,7 @@ void browseByAuthority_browsingAroundWithPrecedingRecordsCount() { .param("precedingRecordsCount", "2"); var actual = parseResponse(doGet(request), AuthorityBrowseResult.class); assertThat(actual).isEqualTo(new AuthorityBrowseResult() - .totalRecords(17).prev("Fantasy").next("Science") + .totalRecords(19).prev("Fantasy").next("Revolution") .items(List.of( authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), @@ -102,7 +102,7 @@ void browseByAuthority_browsingAroundWithPrecedingRecordsCount() { authorityBrowseItem("North America", 11, "Geographic Name", REFERENCE, null), authorityBrowseItem("Novel", 19, "Genre", AUTHORIZED, 0), authorityBrowseItem("Poetry", 20, "Genre", REFERENCE, null), - authorityBrowseItem("Science", 16, "Topical", AUTHORIZED, 0)))); + authorityBrowseItem("Revolution", 26, "Named Event", REFERENCE, null)))); } @Test @@ -112,7 +112,7 @@ void browseByAuthority_browsingAroundWithSeveralExactMatches() { .param("limit", "3"); var actual = parseResponse(doGet(request), AuthorityBrowseResult.class); assertThat(actual).isEqualTo(new AuthorityBrowseResult() - .totalRecords(17).prev("War and Peace").next(null) + .totalRecords(19).prev("War and Peace").next(null) .items(List.of( authorityBrowseItem("War and Peace", 14, "Uniform Title", REFERENCE, null), authorityBrowseItem("Zappa Frank", 23, "Personal Name", AUTHORIZED, 0).isAnchor(true), @@ -129,10 +129,10 @@ void browseByAuthority_browsingAroundWithoutHighlightMatch() { var actual = parseResponse(doGet(request), AuthorityBrowseResult.class); assertThat(actual).isEqualTo(new AuthorityBrowseResult() - .totalRecords(17).prev("Comic-Con").next("Ĵämes Röllins") + .totalRecords(19).prev("Disney").next("Ĵämes Röllins") .items(List.of( - authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0), authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), authorityBrowseItem("Ĵämes Röllins", 2, "Personal Name", REFERENCE, null)))); @@ -148,7 +148,7 @@ private static Stream authorityBrowsingDataProvider() { return Stream.of( arguments(aroundQuery, "Brian K. Vaughan", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Biomedical Symposium").next("Comic-Con") + .totalRecords(19).prev("Biomedical Symposium").next("Comic-Con") .items(List.of( authorityBrowseItem("Biomedical Symposium", 8, "Conference Name", REFERENCE, null), authorityBrowseItem("Blumberg Green Beauty", 5, "Corporate Name", REFERENCE, null), @@ -157,30 +157,30 @@ private static Stream authorityBrowsingDataProvider() { authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0)))), arguments(aroundQuery, "harry", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Disney").next("Ĵämes Röllins") + .totalRecords(19).prev("Eruption of Vesuvius").next("Ĵämes Röllins") .items(List.of( - authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), emptyAuthorityBrowseItem("harry"), authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), authorityBrowseItem("Ĵämes Röllins", 2, "Personal Name", REFERENCE, null)))), arguments(aroundQuery, "a", 5, new AuthorityBrowseResult() - .totalRecords(17).prev(null).next("Biomedical Symposium") + .totalRecords(19).prev(null).next("Biomedical Symposium") .items(List.of( emptyAuthorityBrowseItem("a"), authorityBrowseItem("Asia Pacific", 10, "Geographic Name", AUTHORIZED, 0), authorityBrowseItem("Biomedical Symposium", 8, "Conference Name", REFERENCE, null)))), arguments(aroundQuery, "zz", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Zappa Frank").next(null) + .totalRecords(19).prev("Zappa Frank").next(null) .items(List.of( authorityBrowseItem("Zappa Frank", 24, "Topical", AUTHORIZED, 0), authorityBrowseItem("Zappa Frank", 23, "Personal Name", AUTHORIZED, 0), emptyAuthorityBrowseItem("zz")))), arguments(aroundIncludingQuery, "Brian K. Vaughan", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Biomedical Symposium").next("Comic-Con") + .totalRecords(19).prev("Biomedical Symposium").next("Comic-Con") .items(List.of( authorityBrowseItem("Biomedical Symposium", 8, "Conference Name", REFERENCE, null), authorityBrowseItem("Blumberg Green Beauty", 5, "Corporate Name", REFERENCE, null), @@ -189,16 +189,16 @@ private static Stream authorityBrowsingDataProvider() { authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0)))), arguments(aroundIncludingQuery, "harry", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Disney").next("Ĵämes Röllins") + .totalRecords(19).prev("Eruption of Vesuvius").next("Ĵämes Röllins") .items(List.of( - authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), emptyAuthorityBrowseItem("harry"), authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), authorityBrowseItem("Ĵämes Röllins", 2, "Personal Name", REFERENCE, null)))), arguments(aroundIncludingQuery, "music", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Harry Potter").next("Novel") + .totalRecords(19).prev("Harry Potter").next("Novel") .items(List.of( authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), authorityBrowseItem("Ĵämes Röllins", 2, "Personal Name", REFERENCE, null), @@ -207,7 +207,7 @@ private static Stream authorityBrowsingDataProvider() { authorityBrowseItem("Novel", 19, "Genre", AUTHORIZED, 0)))), arguments(aroundIncludingQuery, "music", 25, new AuthorityBrowseResult() - .totalRecords(17).prev(null).next(null) + .totalRecords(19).prev(null).next(null) .items(List.of( authorityBrowseItem("Asia Pacific", 10, "Geographic Name", AUTHORIZED, 0), authorityBrowseItem("Biomedical Symposium", 8, "Conference Name", REFERENCE, null), @@ -216,6 +216,7 @@ private static Stream authorityBrowsingDataProvider() { authorityBrowseItem("Brian K. Vaughan Title", 1, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0), authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), authorityBrowseItem("Ĵämes Röllins", 2, "Personal Name", REFERENCE, null), @@ -223,6 +224,7 @@ private static Stream authorityBrowsingDataProvider() { authorityBrowseItem("North America", 11, "Geographic Name", REFERENCE, null), authorityBrowseItem("Novel", 19, "Genre", AUTHORIZED, 0), authorityBrowseItem("Poetry", 20, "Genre", REFERENCE, null), + authorityBrowseItem("Revolution", 26, "Named Event", REFERENCE, null), authorityBrowseItem("Science", 16, "Topical", AUTHORIZED, 0), authorityBrowseItem("War and Peace", 14, "Uniform Title", REFERENCE, null), authorityBrowseItem("Zappa Frank", 23, "Personal Name", AUTHORIZED, 0), @@ -230,10 +232,10 @@ private static Stream authorityBrowsingDataProvider() { ))), arguments(aroundIncludingQuery, "music", 11, new AuthorityBrowseResult() - .totalRecords(17).prev("Comic-Con").next("War and Peace") + .totalRecords(19).prev("Disney").next("Science") .items(List.of( - authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0), authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), authorityBrowseItem("Ĵämes Röllins", 2, "Personal Name", REFERENCE, null), @@ -241,13 +243,13 @@ private static Stream authorityBrowsingDataProvider() { authorityBrowseItem("North America", 11, "Geographic Name", REFERENCE, null), authorityBrowseItem("Novel", 19, "Genre", AUTHORIZED, 0), authorityBrowseItem("Poetry", 20, "Genre", REFERENCE, null), - authorityBrowseItem("Science", 16, "Topical", AUTHORIZED, 0), - authorityBrowseItem("War and Peace", 14, "Uniform Title", REFERENCE, null)))), + authorityBrowseItem("Revolution", 26, "Named Event", REFERENCE, null), + authorityBrowseItem("Science", 16, "Topical", AUTHORIZED, 0)))), arguments(aroundIncludingQuery, "FC", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Disney").next("Ĵämes Röllins") + .totalRecords(19).prev("Eruption of Vesuvius").next("Ĵämes Röllins") .items(List.of( - authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), emptyAuthorityBrowseItem("FC"), authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), @@ -255,16 +257,16 @@ private static Stream authorityBrowsingDataProvider() { // browsing forward arguments(forwardQuery, "Brian K. Vaughan", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Brian K. Vaughan Title").next("Harry Potter") + .totalRecords(19).prev("Brian K. Vaughan Title").next("Fantasy") .items(List.of( authorityBrowseItem("Brian K. Vaughan Title", 1, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0), authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), - authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), - authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0)))), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), + authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null)))), arguments(forwardQuery, "biology", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Biomedical Symposium").next("Comic-Con") + .totalRecords(19).prev("Biomedical Symposium").next("Comic-Con") .items(List.of( authorityBrowseItem("Biomedical Symposium", 8, "Conference Name", REFERENCE, null), authorityBrowseItem("Blumberg Green Beauty", 5, "Corporate Name", REFERENCE, null), @@ -274,7 +276,7 @@ private static Stream authorityBrowsingDataProvider() { // checks if collapsing works in forward direction arguments(forwardQuery, "F", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Fantasy").next("Novel") + .totalRecords(19).prev("Fantasy").next("Novel") .items(List.of( authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null), authorityBrowseItem("Harry Potter", 13, "Uniform Title", AUTHORIZED, 0), @@ -283,20 +285,20 @@ private static Stream authorityBrowsingDataProvider() { authorityBrowseItem("Novel", 19, "Genre", AUTHORIZED, 0)))), arguments(forwardQuery, "ZZ", 10, new AuthorityBrowseResult() - .totalRecords(17).prev(null).next(null) + .totalRecords(19).prev(null).next(null) .items(emptyList())), arguments(forwardIncludingQuery, "Brian K. Vaughan", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Brian K. Vaughan").next("Fantasy") + .totalRecords(19).prev("Brian K. Vaughan").next("Eruption of Vesuvius") .items(List.of( authorityBrowseItem("Brian K. Vaughan", 22, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Brian K. Vaughan Title", 1, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0), authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), - authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null)))), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0)))), arguments(forwardIncludingQuery, "biology", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Biomedical Symposium").next("Comic-Con") + .totalRecords(19).prev("Biomedical Symposium").next("Comic-Con") .items(List.of( authorityBrowseItem("Biomedical Symposium", 8, "Conference Name", REFERENCE, null), authorityBrowseItem("Blumberg Green Beauty", 5, "Corporate Name", REFERENCE, null), @@ -306,36 +308,36 @@ private static Stream authorityBrowsingDataProvider() { // browsing backward arguments(backwardQuery, "Brian K. Vaughan", 5, new AuthorityBrowseResult() - .totalRecords(17).prev(null).next("Blumberg Green Beauty") + .totalRecords(19).prev(null).next("Blumberg Green Beauty") .items(List.of( authorityBrowseItem("Asia Pacific", 10, "Geographic Name", AUTHORIZED, 0), authorityBrowseItem("Biomedical Symposium", 8, "Conference Name", REFERENCE, null), authorityBrowseItem("Blumberg Green Beauty", 5, "Corporate Name", REFERENCE, null)))), arguments(backwardQuery, "fun", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Brian K. Vaughan").next("Fantasy") + .totalRecords(19).prev("Brian K. Vaughan Title").next("Fantasy") .items(List.of( - authorityBrowseItem("Brian K. Vaughan", 22, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Brian K. Vaughan Title", 1, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0), authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null)))), arguments(backwardQuery, "G", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Brian K. Vaughan").next("Fantasy") + .totalRecords(19).prev("Brian K. Vaughan Title").next("Fantasy") .items(List.of( - authorityBrowseItem("Brian K. Vaughan", 22, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Brian K. Vaughan Title", 1, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0), authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null)))), arguments(backwardQuery, "A", 10, new AuthorityBrowseResult() - .totalRecords(17).prev(null).next(null) + .totalRecords(19).prev(null).next(null) .items(emptyList())), arguments(backwardIncludingQuery, "Brian K. Vaughan", 5, new AuthorityBrowseResult() - .totalRecords(17).prev(null).next("Brian K. Vaughan") + .totalRecords(19).prev(null).next("Brian K. Vaughan") .items(List.of( authorityBrowseItem("Asia Pacific", 10, "Geographic Name", AUTHORIZED, 0), authorityBrowseItem("Biomedical Symposium", 8, "Conference Name", REFERENCE, null), @@ -343,12 +345,12 @@ private static Stream authorityBrowsingDataProvider() { authorityBrowseItem("Brian K. Vaughan", 22, "Personal Name", AUTHORIZED, 0)))), arguments(backwardIncludingQuery, "fun", 5, new AuthorityBrowseResult() - .totalRecords(17).prev("Brian K. Vaughan").next("Fantasy") + .totalRecords(19).prev("Brian K. Vaughan Title").next("Fantasy") .items(List.of( - authorityBrowseItem("Brian K. Vaughan", 22, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Brian K. Vaughan Title", 1, "Personal Name", AUTHORIZED, 0), authorityBrowseItem("Comic-Con", 7, "Conference Name", AUTHORIZED, 0), authorityBrowseItem("Disney", 4, "Corporate Name", AUTHORIZED, 0), + authorityBrowseItem("Eruption of Vesuvius", 25, "Named Event", AUTHORIZED, 0), authorityBrowseItem("Fantasy", 17, "Topical", REFERENCE, null)))) ); } @@ -380,6 +382,9 @@ private static Authority[] authorities() { authority(22).personalName("Brian K. Vaughan"), authority(23).personalName("Zappa Frank"), authority(24).topicalTerm("Zappa Frank"), + authority(25).namedEvent("Eruption of Vesuvius"), + authority(26).sftNamedEvent(List.of("Revolution")), + authority(27).saftNamedEvent(List.of("Stock Market Crash")) }; } diff --git a/src/test/java/org/folio/search/controller/SearchAuthorityIT.java b/src/test/java/org/folio/search/controller/SearchAuthorityIT.java index 292c152f2..3f8aa47d2 100644 --- a/src/test/java/org/folio/search/controller/SearchAuthorityIT.java +++ b/src/test/java/org/folio/search/controller/SearchAuthorityIT.java @@ -43,7 +43,7 @@ class SearchAuthorityIT extends BaseIntegrationTest { @BeforeAll static void prepare() { - setUpTenant(Authority.class, 30, getAuthoritySampleAsMap()); + setUpTenant(Authority.class, 33, getAuthoritySampleAsMap()); //set up linked instances var instance1 = new Instance().id(randomId()).title("test-resource") @@ -95,7 +95,7 @@ void searchByAuthoritiesCaseInsensitive_parameterized(String query, String value @ParameterizedTest(name = "[{index}] query={0}, value=''{1}''") @DisplayName("search by authorities (check that they are divided correctly)") void searchByAuthorities_parameterized_all(String query, String value) throws Exception { - var response = doSearchByAuthorities(prepareQuery(query, value)).andExpect(jsonPath("$.totalRecords", is(30))); + var response = doSearchByAuthorities(prepareQuery(query, value)).andExpect(jsonPath("$.totalRecords", is(33))); var actual = parseResponse(response, AuthoritySearchResult.class); assertThat(actual.getAuthorities()).asInstanceOf(InstanceOfAssertFactories. LIST).containsOnly( authority("Personal Name", AUTHORIZED_TYPE, "Gary A. Wills", 4), @@ -130,6 +130,10 @@ void searchByAuthorities_parameterized_all(String query, String value) throws Ex authority("Uniform Title", REFERENCE_TYPE, "a sft uniform title", null), authority("Uniform Title", AUTH_REF_TYPE, "a saft uniform title", null), + authority("Named Event", AUTHORIZED_TYPE, "a named event", 4), + authority("Named Event", REFERENCE_TYPE, "a sft named event", null), + authority("Named Event", AUTH_REF_TYPE, "a saft named event", null), + authority("Topical", AUTHORIZED_TYPE, "a topical term", 4), authority("Topical", REFERENCE_TYPE, "a sft topical term", null), authority("Topical", AUTH_REF_TYPE, "a saft topical term", null), @@ -157,6 +161,9 @@ private static Stream testDataProvider() { arguments("keyword == {value}", "\"an uniform title\""), arguments("keyword all {value}", "\"a sft uniform title\""), arguments("keyword all {value}", "\"a saft uniform title\""), + arguments("keyword == {value}", "\"a named event\""), + arguments("keyword all {value}", "\"a sft named event\""), + arguments("keyword all {value}", "\"a saft named event\""), arguments("keyword == {value}", "\"a topical term\""), arguments("keyword all {value}", "\"a sft topical term\""), arguments("keyword all {value}", "\"a saft topical term\""), @@ -228,6 +235,16 @@ private static Stream testDataProvider() { arguments("saftUniformTitle = {value} ", "\"title saft\""), arguments("saftUniformTitle == {value} ", "\"saft uniform title\""), + arguments("namedEvent all {value}", "\"a named event\""), + arguments("namedEvent all {value}", "named"), + arguments("namedEvent == {value}", "\"a nam*\""), + arguments("namedEvent == {value} and headingType==\"Named Event\"", "\"a nam*\""), + arguments("sftNamedEvent = {value}", "\"sft named event\""), + arguments("sftNamedEvent == {value}", "\"sft named event\""), + arguments("sftNamedEvent == {value}", "\"*nam*\""), + arguments("saftNamedEvent = {value}", "\"saft event\""), + arguments("saftNamedEvent == {value}", "\"*saft nam*\""), + arguments("topicalTerm all {value}", "\"a topical term\""), arguments("topicalTerm all {value}", "topical"), arguments("topicalTerm == {value}", "\"a top*\""), @@ -345,6 +362,14 @@ private static Stream testCaseInsensitiveDataProvider() { arguments("saftUniformTitle = {value} ", "\"TITLE SAFT\""), arguments("saftUniformTitle == {value} ", "\"SAFT UNIFORM TITLE\""), + arguments("namedEvent all {value}", "\"A NAMED EVENT\""), + arguments("namedEvent all {value}", "NAMED"), + arguments("namedEvent == {value}", "\"A NAM*\""), + arguments("sftNamedEvent = {value}", "\"SFT NAMED EVENT\""), + arguments("sftNamedEvent == {value}", "\"*NAM*\""), + arguments("saftNamedEvent = {value}", "\"SAFT EVENT\""), + arguments("saftNamedEvent == {value}", "\"*SAFT NAM*\""), + arguments("topicalTerm all {value}", "\"A TOPICAL TERM\""), arguments("topicalTerm all {value}", "TOPICAL"), arguments("topicalTerm == {value}", "\"A TOP*\""), diff --git a/src/test/java/org/folio/search/controller/StreamResourceIdsIT.java b/src/test/java/org/folio/search/controller/StreamResourceIdsIT.java index 07bb4e7c8..a6eb6509e 100644 --- a/src/test/java/org/folio/search/controller/StreamResourceIdsIT.java +++ b/src/test/java/org/folio/search/controller/StreamResourceIdsIT.java @@ -40,7 +40,7 @@ class StreamResourceIdsIT extends BaseIntegrationTest { private static final int SAVED_INSTANCES_AMOUNT = 1; - private static final int SAVED_AUTHORITIES_AMOUNT = 30; + private static final int SAVED_AUTHORITIES_AMOUNT = 33; @BeforeAll static void prepare() { diff --git a/src/test/java/org/folio/search/service/converter/preprocessor/AuthorityEventPreProcessorTest.java b/src/test/java/org/folio/search/service/converter/preprocessor/AuthorityEventPreProcessorTest.java index 5c1282244..79aa25130 100644 --- a/src/test/java/org/folio/search/service/converter/preprocessor/AuthorityEventPreProcessorTest.java +++ b/src/test/java/org/folio/search/service/converter/preprocessor/AuthorityEventPreProcessorTest.java @@ -79,7 +79,10 @@ void process_positive() { event("saftCorporateNameTitle1", expectedAuthorityAsMap(authority, "saftCorporateNameTitle[1]")), event("uniformTitle0", expectedAuthorityAsMap(authority, "uniformTitle")), event("sftUniformTitle0", expectedAuthorityAsMap(authority, "sftUniformTitle[0]")), - event("saftUniformTitle0", expectedAuthorityAsMap(authority, "saftUniformTitle[0]")) + event("saftUniformTitle0", expectedAuthorityAsMap(authority, "saftUniformTitle[0]")), + event("namedEvent0", expectedAuthorityAsMap(authority, "namedEvent")), + event("sftNamedEvent0", expectedAuthorityAsMap(authority, "sftNamedEvent[0]")), + event("saftNamedEvent0", expectedAuthorityAsMap(authority, "saftNamedEvent[0]")) )); } @@ -162,6 +165,9 @@ private static Authority fullAuthorityRecord() { .uniformTitle("an uniform title") .sftUniformTitle(List.of("a sft uniform title")) .saftUniformTitle(List.of("a saft uniform title")) + .namedEvent("a named event") + .sftNamedEvent(List.of("a sft named event")) + .saftNamedEvent(List.of("a saft named event")) .subjectHeadings("a subject heading") .identifiers(List.of(new Identifier() .value("an identifier value") @@ -191,6 +197,9 @@ private static ResourceDescription authorityResourceDescription() { "uniformTitle", authorityField("uniformTitle"), "sftUniformTitle", authorityField("sftUniformTitle"), "saftUniformTitle", authorityField("saftUniformTitle"), + "namedEvent", authorityField("namedEvent"), + "sftNamedEvent", authorityField("sftNamedEvent"), + "saftNamedEvent", authorityField("saftNamedEvent"), "shared", standardField() )); } diff --git a/src/test/resources/samples/authority-sample/authority.json b/src/test/resources/samples/authority-sample/authority.json index ec93a182a..1ba6d9d94 100644 --- a/src/test/resources/samples/authority-sample/authority.json +++ b/src/test/resources/samples/authority-sample/authority.json @@ -24,6 +24,9 @@ "uniformTitle": "an uniform title", "sftUniformTitle": [ "a sft uniform title" ], "saftUniformTitle": [ "a saft uniform title" ], + "namedEvent": "a named event", + "sftNamedEvent": [ "a sft named event" ], + "saftNamedEvent": [ "a saft named event" ], "topicalTerm": "a topical term", "sftTopicalTerm": [ "a sft topical term" ], "saftTopicalTerm": [ "a saft topical term" ],