From 898bb5857a0f371d3c46463debd729252d03bc81 Mon Sep 17 00:00:00 2001 From: viacheslav_kolesnyk Date: Fri, 28 Jun 2024 14:55:03 +0200 Subject: [PATCH 1/2] feat(search-instances): Index, search Index Instance place of publication field - Update dto - Update index mappings Implements: MSEARCH-755 --- NEWS.md | 1 + src/main/resources/model/instance.json | 4 ++++ .../examples/result/instanceSearchResult.yaml | 1 + .../schemas/dto/instance/publication.yaml | 3 +++ .../folio/search/controller/SearchByAllFieldsIT.java | 6 +++++- .../folio/search/controller/SearchInstanceIT.java | 12 ++++++++++++ .../instance-basic-response.json | 3 ++- .../instance-full-response.json | 3 ++- 8 files changed, 30 insertions(+), 3 deletions(-) diff --git a/NEWS.md b/NEWS.md index 16a4f6af5..aa931ad9f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -26,6 +26,7 @@ * Implement Indexing of Institutions from Kafka ([MSEARCH-771](https://issues.folio.org/browse/MSEARCH-771)) * Implement Indexing of Libraries from Kafka ([MSEARCH-769](https://issues.folio.org/browse/MSEARCH-769)) * Return Unified List of Inventory Campuses in a Consortium ([MSEARCH-773](https://issues.folio.org/browse/MSEARCH-773)) +* Index, search Instance place of publication field ([MSEARCH-755](https://folio-org.atlassian.net/browse/MSEARCH-755)) ### Bug fixes * Do not delete kafka topics if collection topic is enabled ([MSEARCH-725](https://folio-org.atlassian.net/browse/MSEARCH-725)) diff --git a/src/main/resources/model/instance.json b/src/main/resources/model/instance.json index cd57246ce..2273cb84d 100644 --- a/src/main/resources/model/instance.json +++ b/src/main/resources/model/instance.json @@ -191,6 +191,10 @@ "dateOfPublication": { "index": "source", "showInResponse": [ "search", "call-number-browse" ] + }, + "place": { + "index": "standard", + "showInResponse": [ "search" ] } } }, diff --git a/src/main/resources/swagger.api/examples/result/instanceSearchResult.yaml b/src/main/resources/swagger.api/examples/result/instanceSearchResult.yaml index c93220fc6..8951e9508 100644 --- a/src/main/resources/swagger.api/examples/result/instanceSearchResult.yaml +++ b/src/main/resources/swagger.api/examples/result/instanceSearchResult.yaml @@ -12,6 +12,7 @@ value: publication: - publisher: "Duncker und Humblot" dateOfPublication: "1976" + place: Karlsruhe staffSuppress: false discoverySuppress: false isBoundWith: false diff --git a/src/main/resources/swagger.api/schemas/dto/instance/publication.yaml b/src/main/resources/swagger.api/schemas/dto/instance/publication.yaml index f1cd69caa..6ec5838e5 100644 --- a/src/main/resources/swagger.api/schemas/dto/instance/publication.yaml +++ b/src/main/resources/swagger.api/schemas/dto/instance/publication.yaml @@ -5,4 +5,7 @@ properties: type: string dateOfPublication: description: "Date (year YYYY) of publication, distribution, etc." + type: string + place: + description: "Place of publication, distribution, etc." type: string \ No newline at end of file diff --git a/src/test/java/org/folio/search/controller/SearchByAllFieldsIT.java b/src/test/java/org/folio/search/controller/SearchByAllFieldsIT.java index 14aa4b543..feef40a3e 100644 --- a/src/test/java/org/folio/search/controller/SearchByAllFieldsIT.java +++ b/src/test/java/org/folio/search/controller/SearchByAllFieldsIT.java @@ -40,6 +40,8 @@ static void cleanUp() { "Antoniou matthew", "HD1691 .I5 1967", "Cambridge, Mass.", + "MIT Press", + "c2004", // holding field values "e3ff6133-b9a2-4d4c-a1c9-dc1867d4df19", @@ -76,7 +78,9 @@ void canSearchByAllFieldValues_positive(String cqlQuery) throws Throwable { "HD1691 .I5 1967", "Cambridge, Mass.", "2020-12-08T15:47:13.625+00:00", - "2020-12-08T15:47:13.625+0000" + "2020-12-08T15:47:13.625+0000", + "MIT Press", + "c2004" }) @ParameterizedTest(name = "[{index}] cql.allInstances='{query}', query=''{0}''") void canSearchByInstanceFieldValues_positive(String cqlQuery) throws Throwable { diff --git a/src/test/java/org/folio/search/controller/SearchInstanceIT.java b/src/test/java/org/folio/search/controller/SearchInstanceIT.java index 19bb0a3c2..98e182157 100644 --- a/src/test/java/org/folio/search/controller/SearchInstanceIT.java +++ b/src/test/java/org/folio/search/controller/SearchInstanceIT.java @@ -199,6 +199,18 @@ private static Stream testDataProvider() { arguments("publisher all {value}", "mit"), arguments("publisher all {value}", "press"), + arguments("publication.place all {value}", "cambridge"), + arguments("publication.place all {value}", "Cambridge"), + arguments("publication.place all {value}", "mass"), + arguments("publication.place all {value}", "Mass."), + arguments("publication.place any {value}", "Cambridge mass"), + arguments("publication.place all {value}", "Cambridge mass"), + arguments("publication.place = {value}", "\"Cambridge, Mass.\""), + arguments("publication.place == {value}", "Cambridge"), + arguments("publication.place ==/string {value}", "\"Cambridge, Mass.\""), + arguments("publication.place = {value}", "Cambridge, Ma*"), + arguments("publication.place = {value}", "\"*mbridge, Mass.\""), + arguments("contributors all {value}", "frank"), arguments("contributors all {value}", "Frank"), arguments("contributors all {value}", "grigoris"), diff --git a/src/test/resources/samples/instance-response-sample/instance-basic-response.json b/src/test/resources/samples/instance-response-sample/instance-basic-response.json index b95856f13..538f2d7eb 100644 --- a/src/test/resources/samples/instance-response-sample/instance-basic-response.json +++ b/src/test/resources/samples/instance-response-sample/instance-basic-response.json @@ -23,7 +23,8 @@ "publication": [ { "publisher": "MIT Press", - "dateOfPublication": "c2004" + "dateOfPublication": "c2004", + "place": "Cambridge, Mass. " } ], "staffSuppress": false, diff --git a/src/test/resources/samples/instance-response-sample/instance-full-response.json b/src/test/resources/samples/instance-response-sample/instance-full-response.json index 03c6c3f04..a94e6f182 100644 --- a/src/test/resources/samples/instance-response-sample/instance-full-response.json +++ b/src/test/resources/samples/instance-response-sample/instance-full-response.json @@ -127,7 +127,8 @@ "publication": [ { "publisher": "MIT Press", - "dateOfPublication": "c2004" + "dateOfPublication": "c2004", + "place": "Cambridge, Mass. " } ], "staffSuppress": false, From ac01624419dd25543224142b490421674483c535 Mon Sep 17 00:00:00 2001 From: viacheslav_kolesnyk Date: Mon, 1 Jul 2024 15:22:32 +0200 Subject: [PATCH 2/2] Remove `place` from instance search response --- src/main/resources/model/instance.json | 3 +-- .../instance-response-sample/instance-basic-response.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/resources/model/instance.json b/src/main/resources/model/instance.json index 2273cb84d..adcc282c0 100644 --- a/src/main/resources/model/instance.json +++ b/src/main/resources/model/instance.json @@ -193,8 +193,7 @@ "showInResponse": [ "search", "call-number-browse" ] }, "place": { - "index": "standard", - "showInResponse": [ "search" ] + "index": "standard" } } }, diff --git a/src/test/resources/samples/instance-response-sample/instance-basic-response.json b/src/test/resources/samples/instance-response-sample/instance-basic-response.json index 538f2d7eb..b95856f13 100644 --- a/src/test/resources/samples/instance-response-sample/instance-basic-response.json +++ b/src/test/resources/samples/instance-response-sample/instance-basic-response.json @@ -23,8 +23,7 @@ "publication": [ { "publisher": "MIT Press", - "dateOfPublication": "c2004", - "place": "Cambridge, Mass. " + "dateOfPublication": "c2004" } ], "staffSuppress": false,