Skip to content

Commit

Permalink
Merge pull request #131 from CSCfi/publication-search-by-orcidid
Browse files Browse the repository at this point in the history
Fix publication search by author ORCID ID
  • Loading branch information
sarkikos authored Apr 11, 2024
2 parents efaee4c + 34c2106 commit e75c635
Showing 1 changed file with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ private static IEnumerable<Func<QueryContainerDescriptor<Publication>, QueryCont
.Field(f => f.Authors.Suffix(nameof(Author.LastName))).Query(parameters.AuthorLastName)))))));
}

if (!string.IsNullOrWhiteSpace(parameters.AuthorOrcId))
{
subQueries.Add(
q => q.Nested(
query => query
.Path(p => p.Authors)
.Query(
q => q.Match(m => m
.Field(f => f.Authors.Suffix(nameof(Author.Orcid)))
.Query(parameters.AuthorOrcId)))));
}

if (!string.IsNullOrWhiteSpace(parameters.ConferenceName))
{
subQueries.Add(t =>
Expand Down Expand Up @@ -224,13 +236,6 @@ private static IEnumerable<Func<QueryContainerDescriptor<Publication>, QueryCont
.Value(parameters.OrganizationUnitId)));
}

if (parameters.AuthorOrcId is not null)
{
filters.Add(t =>
t.Term(s => s.Field(f => f.Authors.Suffix(nameof(Author.Orcid)))
.Value(parameters.AuthorOrcId)));
}

// Searching with type code requires exact match.
if (!string.IsNullOrWhiteSpace(parameters.TypeCode))
{
Expand Down

0 comments on commit e75c635

Please sign in to comment.