diff --git a/search-commons/src/main/java/no/unit/nva/search2/model/ResourceParameterKey.java b/search-commons/src/main/java/no/unit/nva/search2/model/ResourceParameterKey.java index e5c6c9288..b0e089596 100644 --- a/search-commons/src/main/java/no/unit/nva/search2/model/ResourceParameterKey.java +++ b/search-commons/src/main/java/no/unit/nva/search2/model/ResourceParameterKey.java @@ -54,43 +54,43 @@ public enum ResourceParameterKey implements ParameterKey { + PIPE + Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_NAME), CONTRIBUTOR_NOT(KEYWORD, MUST_NOT, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ID + PIPE + Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_NAME), - CONTRIBUTOR_SHOULD(KEYWORD, SHOULD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ID + CONTRIBUTOR_SHOULD(TEXT, SHOULD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ID + PIPE + Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_NAME), CREATED_BEFORE(DATE, LESS_THAN, Constants.CREATED_DATE), CREATED_SINCE(DATE, GREATER_THAN_OR_EQUAL_TO, Constants.CREATED_DATE), - DOI(TEXT, Constants.ENTITY_DESCRIPTION_REFERENCE_DOI), + DOI(KEYWORD, Constants.ENTITY_DESCRIPTION_REFERENCE_DOI), DOI_NOT(TEXT, MUST_NOT, Constants.ENTITY_DESCRIPTION_REFERENCE_DOI), DOI_SHOULD(TEXT, SHOULD, Constants.ENTITY_DESCRIPTION_REFERENCE_DOI), FUNDING(KEYWORD, MUST, Constants.FUNDINGS_IDENTIFIER_FUNDINGS_SOURCE_IDENTIFIER, null, PATTERN_IS_FUNDING, null), - FUNDING_SOURCE(TEXT, Constants.FUNDINGS_SOURCE_IDENTIFIER_FUNDINGS_SOURCE_LABELS), - FUNDING_SOURCE_NOT(TEXT, MUST_NOT, Constants.FUNDINGS_SOURCE_IDENTIFIER_FUNDINGS_SOURCE_LABELS), - FUNDING_SOURCE_SHOULD(KEYWORD, SHOULD, Constants.FUNDINGS_SOURCE_IDENTIFIER_FUNDINGS_SOURCE_LABELS), - ID(TEXT, Constants.IDENTIFIER), - ID_NOT(TEXT, MUST_NOT, Constants.IDENTIFIER), + FUNDING_SOURCE(KEYWORD, Constants.FUNDINGS_SOURCE_IDENTIFIER_FUNDINGS_SOURCE_LABELS), + FUNDING_SOURCE_NOT(KEYWORD, MUST_NOT, Constants.FUNDINGS_SOURCE_IDENTIFIER_FUNDINGS_SOURCE_LABELS), + FUNDING_SOURCE_SHOULD(TEXT, SHOULD, Constants.FUNDINGS_SOURCE_IDENTIFIER_FUNDINGS_SOURCE_LABELS), + ID(KEYWORD, Constants.IDENTIFIER), + ID_NOT(KEYWORD, MUST_NOT, Constants.IDENTIFIER), ID_SHOULD(TEXT, SHOULD, Constants.IDENTIFIER), - INSTITUTION(TEXT, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID + PIPE + INSTITUTION(KEYWORD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID + PIPE + Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_NAME), - INSTITUTION_NOT(TEXT, MUST_NOT, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID + PIPE + INSTITUTION_NOT(KEYWORD, MUST_NOT, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID + PIPE + Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_NAME), INSTITUTION_SHOULD(TEXT, SHOULD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID + PIPE + Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_NAME), - ISBN(TEXT, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ISBN_LIST), - ISBN_NOT(TEXT, MUST_NOT, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ISBN_LIST), + ISBN(KEYWORD, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ISBN_LIST), + ISBN_NOT(KEYWORD, MUST_NOT, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ISBN_LIST), ISBN_SHOULD(TEXT, SHOULD, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ISBN_LIST), - ISSN(TEXT, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ONLINE_ISSN + ISSN(KEYWORD, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ONLINE_ISSN + PIPE + Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_PRINT_ISSN), - ISSN_NOT(TEXT, MUST_NOT, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ONLINE_ISSN + ISSN_NOT(KEYWORD, MUST_NOT, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ONLINE_ISSN + PIPE + Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_PRINT_ISSN), ISSN_SHOULD(TEXT, SHOULD, Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_ONLINE_ISSN + PIPE + Constants.ENTITY_DESCRIPTION_REFERENCE_PUBLICATION_CONTEXT_PRINT_ISSN), - ORCID(TEXT, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ORC_ID), - ORCID_NOT(TEXT, MUST_NOT, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ORC_ID), + ORCID(KEYWORD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ORC_ID), + ORCID_NOT(KEYWORD, MUST_NOT, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ORC_ID), ORCID_SHOULD(TEXT, SHOULD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ORC_ID), MODIFIED_BEFORE(DATE, LESS_THAN, Constants.MODIFIED_DATE), MODIFIED_SINCE(DATE, GREATER_THAN_OR_EQUAL_TO, Constants.MODIFIED_DATE), - PROJECT(TEXT, Constants.PROJECTS_ID), - PROJECT_NOT(TEXT, MUST_NOT, Constants.PROJECTS_ID), + PROJECT(KEYWORD, Constants.PROJECTS_ID), + PROJECT_NOT(KEYWORD, MUST_NOT, Constants.PROJECTS_ID), PROJECT_SHOULD(TEXT, SHOULD, Constants.PROJECTS_ID), PUBLISHED_BEFORE(DATE, LESS_THAN, Constants.PUBLISHED_DATE), PUBLISHED_SINCE(DATE, GREATER_THAN_OR_EQUAL_TO, Constants.PUBLISHED_DATE), @@ -99,9 +99,9 @@ public enum ResourceParameterKey implements ParameterKey { TITLE_SHOULD(TEXT, SHOULD, Constants.MAIN_TITLE), UNIT(KEYWORD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID), UNIT_NOT(KEYWORD, MUST_NOT, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID), - UNIT_SHOULD(KEYWORD, SHOULD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID), - USER(TEXT, Constants.RESOURCE_OWNER), - USER_NOT(TEXT, MUST_NOT, Constants.RESOURCE_OWNER), + UNIT_SHOULD(TEXT, SHOULD, Constants.ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID), + USER(KEYWORD, Constants.RESOURCE_OWNER), + USER_NOT(KEYWORD, MUST_NOT, Constants.RESOURCE_OWNER), USER_SHOULD(TEXT, SHOULD, Constants.RESOURCE_OWNER), PUBLICATION_YEAR(NUMBER, MUST, Constants.ENTITY_DESCRIPTION_PUBLICATION_DATE_YEAR, "(?i)year.?reported|publication.?year", null, null), @@ -290,7 +290,9 @@ private static class Constants { public static final String ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_ID = "entityDescription.contributors.affiliations.id.keyword"; public static final String ENTITY_DESCRIPTION_CONTRIBUTORS_AFFILIATION_NAME = - "entityDescription.contributors.affiliations.labels.*.keyword"; + "entityDescription.contributors.affiliations.labels.nb.keyword" + + "|entityDescription.contributors.affiliations.labels.n n.keyword" + + "|entityDescription.contributors.affiliations.labels.en.keyword"; public static final String ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_ID = "entityDescription.contributors.identity.id"; public static final String ENTITY_DESCRIPTION_CONTRIBUTORS_IDENTITY_NAME = diff --git a/search-commons/src/test/java/no/unit/nva/search2/ResourceOpenSearchTest.java b/search-commons/src/test/java/no/unit/nva/search2/ResourceOpenSearchTest.java index fce6a1a95..a2532397b 100644 --- a/search-commons/src/test/java/no/unit/nva/search2/ResourceOpenSearchTest.java +++ b/search-commons/src/test/java/no/unit/nva/search2/ResourceOpenSearchTest.java @@ -107,6 +107,7 @@ void searchWithUriReturnsOpenSearchAwsResponse(URI uri) throws ApiGatewayExcepti var pagedSearchResourceDto = query.toPagedResponse(response); assertNotNull(pagedSearchResourceDto); + logger.info(pagedSearchResourceDto.toJsonString()); assertThat(pagedSearchResourceDto.totalHits(), is(equalTo(pagedSearchResourceDto.hits().size()))); } @@ -121,7 +122,7 @@ static Stream uriProvider() { URI.create("https://x.org/?CONTRIBUTOR_NOT=https://api.dev.nva.aws.unit.no/cristin/person/1136254," + "https://api.dev.nva.aws.unit.no/cristin/person/1136918&size=18"), URI.create("https://x.org/?CONTRIBUTOR_SHOULD=https://api.dev.nva.aws.unit.no/cristin/person/1136254," - + "https://api.dev.nva.aws.unit.no/cristin/person/1136918&size=10"), + + "person/1136918&size=10"), URI.create("https://x.org/?INSTITUTION=" + "https://api.dev.nva.aws.unit.no/cristin/organization/1627.0.0.0&size=2"), URI.create("https://x.org//?INSTITUTION_NOT=" @@ -143,9 +144,9 @@ static Stream uriProvider() { URI.create("https://x.org/?funding=AFR:296896&size=2"), URI.create("https://x.org/?funding=NFR:1296896&size=2"), URI.create("https://x.org/?funding=NFR:296896&size=2"), - URI.create("https://x.org/?funding_source_should=Norges+forskningsråd&size=2"), - URI.create("https://x.org/?funding_source_not=Norges&size=19"), - URI.create("https://x.org/?funding_source=Norges&size=2"), + URI.create("https://x.org/?funding_source=Norges+forskningsråd&size=2"), + URI.create("https://x.org/?funding_source_not=Norges+forskningsråd&size=19"), + URI.create("https://x.org/?funding_source_SHOULD=Norges+epler&size=2"), URI.create("https://x.org/?funding_source=Research+Council+of+Norway+(RCN)&size=2"), URI.create("https://x.org/?published_before=2020-01-01&size=2"), URI.create("https://x.org/?published_since=2023-11-05&size=2"),