Skip to content

Commit

Permalink
Merge pull request #171 from CSCfi/CSCTTV-4052-jufoclass-recorded-mod…
Browse files Browse the repository at this point in the history
…ifcations

Add search parameters jufoClass and jufoClassRecorded
  • Loading branch information
sarkikos authored Dec 16, 2024
2 parents 4f65517 + c2d9212 commit 09b9e51
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 13 deletions.
24 changes: 20 additions & 4 deletions aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public class GetPublicationsQueryParameters
/// <summary>
/// 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
/// </summary>
/// <see cref="Publication.Type"/>
public string? Type { get; set; }
Expand Down Expand Up @@ -127,11 +127,27 @@ public class GetPublicationsQueryParameters
public string? JufoCode { get; set; }

/// <summary>
/// The field jufoCodeRecorded contains text.
/// The field jufoCodeRecorded contains text. Recorded as part of national publication data collection.
/// </summary>
/// <see cref="Publication.JufoCodeRecorded"/>
public string? JufoCodeRecorded { get; set; }

/// <summary>
/// The field jufoClass is exactly equal to text.
///
/// Code: https://koodistot.suomi.fi/codescheme;registryCode=research;schemeCode=Julkaisufoorumiluokitus
/// </summary>
/// <see cref="Publication.JufoClass"/>
public string? JufoClass { get; set; }

/// <summary>
/// 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
/// </summary>
/// <see cref="Publication.JufoClassRecorded"/>
public string? JufoClassRecorded { get; set; }

/// <summary>
/// The field doi is exactly equal to the text.
/// </summary>
Expand All @@ -148,7 +164,7 @@ public class GetPublicationsQueryParameters
/// <summary>
/// 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
/// </summary>
/// <see cref="Publication.PublisherOpenAccess"/>
public string? PublisherOpenAccess { get; set; }
Expand All @@ -162,7 +178,7 @@ public class GetPublicationsQueryParameters
/// <summary>
/// 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
/// </summary>
/// <see cref="Publication.Status"/>
public string? Status { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,6 @@ private static IEnumerable<Func<QueryContainerDescriptor<Publication>, 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)
{
Expand Down Expand Up @@ -304,6 +295,33 @@ private static IEnumerable<Func<QueryContainerDescriptor<Publication>, 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))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down

0 comments on commit 09b9e51

Please sign in to comment.