From c2d9212ced3c346a0bf3bcdf6e88a2bb76246359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Sa=CC=88rkikoski?= Date: Thu, 12 Dec 2024 14:32:19 +0200 Subject: [PATCH] Add search parameters jufoClass and jufoClassRecorded --- .../Query/GetPublicationsQueryParameters.cs | 24 ++++++++++--- .../PublicationQueryGenerator.cs | 36 ++++++++++++++----- .../PublicationSearchParameters.cs | 4 +++ 3 files changed, 51 insertions(+), 13 deletions(-) diff --git a/aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs b/aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs index 6920ed7..35372c5 100644 --- a/aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs +++ b/aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs @@ -71,7 +71,7 @@ public class GetPublicationsQueryParameters /// /// The field type:code is exactly equal to the text. /// - /// Code: http://uri.suomi.fi/codelist/research/Julkaisutyyppiluokitus + /// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=Julkaisutyyppiluokitus /// /// public string? Type { get; set; } @@ -127,11 +127,27 @@ public class GetPublicationsQueryParameters public string? JufoCode { get; set; } /// - /// The field jufoCodeRecorded contains text. + /// The field jufoCodeRecorded contains text. Recorded as part of national publication data collection. /// /// public string? JufoCodeRecorded { get; set; } + /// + /// The field jufoClass is exactly equal to text. + /// + /// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=Julkaisufoorumiluokitus + /// + /// + public string? JufoClass { get; set; } + + /// + /// The field jufoClassRecorded is exactly equal to text. Recorded as part of national publication data collection. + /// + /// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=Julkaisufoorumiluokitus + /// + /// + public string? JufoClassRecorded { get; set; } + /// /// The field doi is exactly equal to the text. /// @@ -148,7 +164,7 @@ public class GetPublicationsQueryParameters /// /// The field publisherOpenAccess:code is exactly equal to the text. /// - /// Code: http://uri.suomi.fi/codelist/research/JulkaisuKanavaOA + /// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=JulkaisuKanavaOA /// /// public string? PublisherOpenAccess { get; set; } @@ -162,7 +178,7 @@ public class GetPublicationsQueryParameters /// /// The field status is exactly equal to the text. /// - /// Code: http://uri.suomi.fi/codelist/research/julkaisuntila + /// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=julkaisuntila /// /// public string? Status { get; set; } diff --git a/aspnetcore/src/ElasticService/ElasticSearchQueryGenerators/PublicationQueryGenerator.cs b/aspnetcore/src/ElasticService/ElasticSearchQueryGenerators/PublicationQueryGenerator.cs index e92bb7b..1d9e996 100644 --- a/aspnetcore/src/ElasticService/ElasticSearchQueryGenerators/PublicationQueryGenerator.cs +++ b/aspnetcore/src/ElasticService/ElasticSearchQueryGenerators/PublicationQueryGenerator.cs @@ -258,15 +258,6 @@ private static IEnumerable, QueryCont .Value(parameters.TypeCode) )); } - - // Searching with publisher open access code requires exact match. - if (!string.IsNullOrWhiteSpace(parameters.PublisherOpenAccess)) - { - filters.Add(t => t.Term(term => term - .Field(f => f.PublisherOpenAccess!.Code) - .Value(parameters.PublisherOpenAccess) - )); - } if (parameters.Issn is not null) { @@ -304,6 +295,33 @@ private static IEnumerable, QueryCont .Value(parameters.Doi))); } + // Searching with jufo class requires exact match. + if (!string.IsNullOrWhiteSpace(parameters.JufoClass)) + { + filters.Add(t => t.Term(term => term + .Field(f => f.JufoClass!.Code) + .Value(parameters.JufoClass) + )); + } + + // Searching with jufo class recorded requires exact match. + if (!string.IsNullOrWhiteSpace(parameters.JufoClassRecorded)) + { + filters.Add(t => t.Term(term => term + .Field(f => f.JufoClassRecorded!.Code) + .Value(parameters.JufoClassRecorded) + )); + } + + // Searching with publisher open access code requires exact match. + if (!string.IsNullOrWhiteSpace(parameters.PublisherOpenAccess)) + { + filters.Add(t => t.Term(term => term + .Field(f => f.PublisherOpenAccess!.Code) + .Value(parameters.PublisherOpenAccess) + )); + } + // Searching with status requires exact match. if (!string.IsNullOrWhiteSpace(parameters.Status)) { diff --git a/aspnetcore/src/ElasticService/SearchParameters/PublicationSearchParameters.cs b/aspnetcore/src/ElasticService/SearchParameters/PublicationSearchParameters.cs index 346256c..d5b98ce 100644 --- a/aspnetcore/src/ElasticService/SearchParameters/PublicationSearchParameters.cs +++ b/aspnetcore/src/ElasticService/SearchParameters/PublicationSearchParameters.cs @@ -41,6 +41,10 @@ public class PublicationSearchParameters public string? JufoCode { get; set; } public string? JufoCodeRecorded { get; set; } + + public string? JufoClass { get; set; } + + public string? JufoClassRecorded { get; set; } public string? Doi { get; set; }