diff --git a/aspnetcore/src/ApiModels/Publication/Publication.cs b/aspnetcore/src/ApiModels/Publication/Publication.cs
index 2410dd7..672d454 100644
--- a/aspnetcore/src/ApiModels/Publication/Publication.cs
+++ b/aspnetcore/src/ApiModels/Publication/Publication.cs
@@ -283,4 +283,14 @@ public class Publication
/// Modification time
///
public DateTime? Modified { get; set; }
+
+ ///
+ /// Combined information of co-publications based on national publication data collection
+ ///
+ public string? CoPublicationID { get; set; }
+
+ ///
+ /// Publication information sent by individual organisations related to co-publications as part of national publication data collection
+ ///
+ public List? OrgPublicationIDs { get; set; }
}
\ No newline at end of file
diff --git a/aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs b/aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs
index 2bd7eb9..48e46c1 100644
--- a/aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs
+++ b/aspnetcore/src/ApiModels/Query/GetPublicationsQueryParameters.cs
@@ -184,4 +184,16 @@ public class GetPublicationsQueryParameters : PaginationQueryParameters
///
///
public string? ModifiedTo { get; set; }
+
+ ///
+ /// If the selection is true, publication information sent by individual organisations related to co-publications as part of national publication data collection will be returned. Not returned by default.
+ ///
+ ///
+ public bool? ShowOrganisationPartofCoPublication { get; set; }
+
+ ///
+ /// If the selection is true, combined information of co-publications based on national publication data collection will be filtered out. Returned by default.
+ ///
+ ///
+ public bool? HideCoPublications { get; set; }
}
\ No newline at end of file
diff --git a/aspnetcore/src/ElasticService/ElasticSearchExtensions.cs b/aspnetcore/src/ElasticService/ElasticSearchExtensions.cs
index 72780da..34d954b 100644
--- a/aspnetcore/src/ElasticService/ElasticSearchExtensions.cs
+++ b/aspnetcore/src/ElasticService/ElasticSearchExtensions.cs
@@ -36,8 +36,10 @@ private static ConnectionSettings GetConnectionSettings(IConfiguration configura
{
var elasticSearchClusterUrl = configuration["ElasticSearch:Url"] ?? throw new InvalidOperationException("ElasticSearch url missing.");
+ // https://www.elastic.co/guide/en/elasticsearch/client/net-api/7.17/configuration-options.html
var connectionSettings = new ConnectionSettings(new Uri(elasticSearchClusterUrl))
- .DefaultFieldNameInferrer(i => i); // This forces elastic to store .Net objects using type names, instead of camel casing. This enables using nameof when referring to fields.
+ .DefaultFieldNameInferrer(i => i) // This forces elastic to store .Net objects using type names, instead of camel casing. This enables using nameof when referring to fields.
+ .MaximumRetries(5);
if (Debugger.IsAttached)
{
diff --git a/aspnetcore/src/ElasticService/ElasticSearchIndexService.cs b/aspnetcore/src/ElasticService/ElasticSearchIndexService.cs
index 59a5e9e..d1d0d01 100644
--- a/aspnetcore/src/ElasticService/ElasticSearchIndexService.cs
+++ b/aspnetcore/src/ElasticService/ElasticSearchIndexService.cs
@@ -8,7 +8,7 @@ public class ElasticSearchIndexService : IElasticSearchIndexService
private readonly IElasticClient _elasticClient;
private readonly ILogger _logger;
- private const int BatchSize = 2000;
+ private const int BatchSize = 1500;
public ElasticSearchIndexService(IElasticClient elasticClient, ILogger logger)
{
diff --git a/aspnetcore/src/ElasticService/ElasticSearchQueryGenerators/PublicationQueryGenerator.cs b/aspnetcore/src/ElasticService/ElasticSearchQueryGenerators/PublicationQueryGenerator.cs
index faa2362..1f7b9a8 100644
--- a/aspnetcore/src/ElasticService/ElasticSearchQueryGenerators/PublicationQueryGenerator.cs
+++ b/aspnetcore/src/ElasticService/ElasticSearchQueryGenerators/PublicationQueryGenerator.cs
@@ -150,6 +150,20 @@ private static IEnumerable, QueryCont
{
var filters = new List, QueryContainer>>();
+ if (parameters.ShowOrganisationPartofCoPublication is null || (bool)parameters.ShowOrganisationPartofCoPublication == false)
+ {
+ filters.Add(t =>
+ t.Term(s => s.Field(f => f.IsOrgPublication)
+ .Value(false)));
+ }
+
+ if (parameters.HideCoPublications is not null && (bool)parameters.HideCoPublications == true)
+ {
+ filters.Add(t =>
+ t.Term(s => s.Field(f => f.IsCoPublication)
+ .Value(false)));
+ }
+
if (parameters.CreatedFrom is not null)
{
filters.Add(x => x
diff --git a/aspnetcore/src/ElasticService/SearchParameters/PublicationSearchParameters.cs b/aspnetcore/src/ElasticService/SearchParameters/PublicationSearchParameters.cs
index 389d4a0..9d5dc8c 100644
--- a/aspnetcore/src/ElasticService/SearchParameters/PublicationSearchParameters.cs
+++ b/aspnetcore/src/ElasticService/SearchParameters/PublicationSearchParameters.cs
@@ -55,4 +55,8 @@ public class PublicationSearchParameters
public string? ModifiedFrom { get; set; }
public string? ModifiedTo { get; set; }
+
+ public bool? ShowOrganisationPartofCoPublication { get; set; }
+
+ public bool? HideCoPublications { get; set; }
}
\ No newline at end of file
diff --git a/aspnetcore/src/Indexer/Indexer.cs b/aspnetcore/src/Indexer/Indexer.cs
index 26f7e46..5c8ed9c 100644
--- a/aspnetcore/src/Indexer/Indexer.cs
+++ b/aspnetcore/src/Indexer/Indexer.cs
@@ -148,7 +148,7 @@ private async Task IndexEntities(string indexName, IIndexRepository repository,
*/
int skipAmount = 0;
- int takeAmount = 50000;
+ int takeAmount = 30000;
int numOfResults = 0;
int processedCount = 0;
diff --git a/aspnetcore/src/Repositories/Maps/PublicationProfile.cs b/aspnetcore/src/Repositories/Maps/PublicationProfile.cs
index e180455..7826bbc 100644
--- a/aspnetcore/src/Repositories/Maps/PublicationProfile.cs
+++ b/aspnetcore/src/Repositories/Maps/PublicationProfile.cs
@@ -28,6 +28,7 @@ public PublicationProfile()
.ForMember(dst => dst.ApcPaymentYear, opt =>opt.MapFrom(src => (DateTime?)(src.ApcPaymentYear.HasValue ? new DateTime(src.ApcPaymentYear.Value,1,1,0,0,0,DateTimeKind.Utc) : null)))
.ForMember(dst => dst.AuthorsText, opt => opt.MapFrom(src => src.AuthorsText))
.ForMember(dst => dst.DatabaseContributions, opt => opt.MapFrom(src => src.FactContributions))
+ .ForMember(dst => dst.OrgPublicationDatabaseContributionDTOs, opt => opt.MapFrom(src => src.InverseDimPublicationNavigation))
.ForMember(dst => dst.Format, opt => opt.MapFrom(src => src.PublicationTypeCode2Navigation))
.ForMember(dst => dst.ParentPublicationType, opt => opt.MapFrom(src => src.ParentPublicationTypeCodeNavigation))
.ForMember(dst => dst.DatabasePeerReviewed, opt => opt.MapFrom(src => src.PeerReviewed))
@@ -55,8 +56,11 @@ public PublicationProfile()
.ForMember(dst => dst.Doi, opt => opt.MapFrom(src => src.Doi))
.ForMember(dst => dst.DoiHandle, opt => opt.MapFrom(src => src.DoiHandle))
.ForMember(dst => dst.FieldsOfScience, opt => opt.MapFrom(src => src.FactDimReferencedataFieldOfSciences.Select(f => f.DimReferencedata)))
+ .ForMember(dst => dst.OrgPublicationFieldsOfScienceDTOs, opt => opt.MapFrom(src => src.InverseDimPublicationNavigation))
.ForMember(dst => dst.FieldsOfArt, opt => opt.MapFrom(src => src.DimReferencedataNavigation))
+ .ForMember(dst => dst.OrgPublicationFieldsOfArtDTOs, opt => opt.MapFrom(src => src.InverseDimPublicationNavigation))
.ForMember(dst => dst.Keywords, opt => opt.MapFrom(src => src.DimKeywords))
+ .ForMember(dst => dst.OrgPublicationKeywordDTOs, opt => opt.MapFrom(src => src.InverseDimPublicationNavigation))
.ForMember(dst => dst.InternationalPublication, opt => opt.MapFrom(src => src.InternationalPublication != 9 ? src.InternationalPublication == 1 : (bool?)null)) // 0 = kotim. 1 ulkom. 9 = ei tietoa.
.ForMember(dst => dst.Country, opt => opt.MapFrom(src => src.PublicationCountryCodeNavigation))
.ForMember(dst => dst.Language, opt => opt.MapFrom(src => src.LanguageCodeNavigation))
@@ -69,6 +73,7 @@ public PublicationProfile()
.ForMember(dst => dst.Preprint, opt => opt.MapFrom(src => src.DimLocallyReportedPubInfos.Where(i => i.SelfArchivedType == PreprintType)))
.ForMember(dst => dst.SelfArchived, opt => opt.MapFrom(src => src.DimLocallyReportedPubInfos.Where(i => i.SelfArchivedType == SelfArchivedType)))
.ForMember(dst => dst.ArtPublicationTypeCategory, opt => opt.MapFrom(src => src.DimReferencedata))
+ .ForMember(dst => dst.OrgPublicationArtPublicatonTypeCategoryDTOs, opt => opt.MapFrom(src => src.InverseDimPublicationNavigation))
.ForMember(dst => dst.Abstract, opt => opt.MapFrom(src => src.Abstract))
.ForMember(dst => dst.Created, opt => opt.MapFrom(src => src.Created))
.ForMember(dst => dst.Modified, opt => opt.MapFrom(src => src.Modified))
@@ -78,7 +83,10 @@ public PublicationProfile()
.ForMember(dst => dst.Authors, opt => opt.Ignore()) // Handled during in memory operations in the index repository
.ForMember(dst => dst.PeerReviewed, opt => opt.Ignore()) // Handled during in memory operations in the index repository
.ForMember(dst => dst.ParentPublication, opt => opt.Ignore()) // Handled during in memory operations in the index repository
- ;
+ .ForMember(dst => dst.IsOrgPublication, opt => opt.MapFrom(src => src.DimPublicationId != null && src.DimPublicationId > 0)) // Publication is an organization publication, when DimPublicationId references co-publication. This property is used in query filter.
+ .ForMember(dst => dst.IsCoPublication, opt => opt.MapFrom(src => src.InverseDimPublicationNavigation.Count > 0)) // Publication is a co-publication, when InverseDimPublicationNavigation references one or more organization publications. This property is used in query filter.
+ .ForMember(dst => dst.CoPublicationID, opt => opt.MapFrom(src => src.DimPublicationId != null && src.DimPublicationId > 0 ? src.DimPublicationNavigation.PublicationId : null))
+ .ForMember(dst => dst.OrgPublicationIDs, opt => opt.MapFrom(src => src.InverseDimPublicationNavigation.Select(t => t.PublicationId)));
CreateProjection()
.AddTransform(s => string.IsNullOrWhiteSpace(s) ? null : s)
@@ -133,6 +141,26 @@ public PublicationProfile()
.ForMember(dst => dst.ArtPublicationRole, opt => opt.MapFrom(src => src.DimReferencedataActorRole))
.ForMember(dst => dst.ContributionType, opt => opt.MapFrom(src => src.ContributionType));
+ CreateProjection()
+ .ForMember(dst => dst.Id, opt => opt.MapFrom(src => src.Id))
+ .ForMember(dst => dst.DatabaseContributions, opt => opt.MapFrom(src => src.FactContributions));
+
+ CreateProjection()
+ .ForMember(dst => dst.Id, opt => opt.MapFrom(src => src.Id))
+ .ForMember(dst => dst.Keywords, opt => opt.MapFrom(src => src.DimKeywords));
+
+ CreateProjection()
+ .ForMember(dst => dst.Id, opt => opt.MapFrom(src => src.Id))
+ .ForMember(dst => dst.ArtPublicationTypeCategories, opt => opt.MapFrom(src => src.DimReferencedata));
+
+ CreateProjection()
+ .ForMember(dst => dst.Id, opt => opt.MapFrom(src => src.Id))
+ .ForMember(dst => dst.FieldsOfScience, opt => opt.MapFrom(src => src.FactDimReferencedataFieldOfSciences.Select(f => f.DimReferencedata)));
+
+ CreateProjection()
+ .ForMember(dst => dst.Id, opt => opt.MapFrom(src => src.Id))
+ .ForMember(dst => dst.FieldsOfArt, opt => opt.MapFrom(src => src.DimReferencedataNavigation));
+
CreateProjection()
.AddTransform(s => string.IsNullOrWhiteSpace(s) ? null : s)
.ForMember(dst => dst.NameId, opt => opt.MapFrom(src => src.Id))
diff --git a/aspnetcore/src/Repositories/PublicationIndexRepository.cs b/aspnetcore/src/Repositories/PublicationIndexRepository.cs
index 316d392..a58f684 100644
--- a/aspnetcore/src/Repositories/PublicationIndexRepository.cs
+++ b/aspnetcore/src/Repositories/PublicationIndexRepository.cs
@@ -3,7 +3,6 @@
using CSC.PublicApi.DatabaseContext;
using CSC.PublicApi.Service.Models;
using CSC.PublicApi.Service.Models.Publication;
-using Elasticsearch.Net;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Caching.Memory;
using Publication = CSC.PublicApi.Service.Models.Publication.Publication;
@@ -81,7 +80,54 @@ public override List