Skip to content
Snippets Groups Projects
Commit b8be3f26 authored by Nicolas.Rod's avatar Nicolas.Rod
Browse files

feat: new field in index to store contributors without directors

parent 12a3ccce
No related branches found
No related tags found
No related merge requests found
......@@ -125,6 +125,39 @@
}
}
},
"contributorsWithoutDirectors": {
"type": "nested",
"include_in_root": true,
"properties": {
"firstName": {
"type": "keyword"
},
"lastName": {
"type": "keyword"
},
"fullName": {
"type": "keyword"
},
"role": {
"type": "keyword"
},
"institution": {
"type": "text"
},
"structure": {
"type": "keyword"
},
"cnIndividu": {
"type": "keyword"
},
"orcid": {
"type": "keyword"
},
"email": {
"type": "keyword"
}
}
},
"contributorsWithOtherNames": {
"type": "nested",
"include_in_root": true,
......
......@@ -314,6 +314,8 @@ public class CommonMetadataService extends AouService {
List<Map<String, String>> contributors = new ArrayList<>();
Set<String> unigeDirectors = new HashSet<>();
List<Map<String, String>> contributorsWithOtherNames = new ArrayList<>();
List<Map<String, String>> contributorsWithoutDirectors = new ArrayList<>();
for (AbstractContributor abstractContributor : depositDocAdapter.getContributors(depositDoc)) {
Map<String, String> contributorMap = new HashMap<>();
if (abstractContributor instanceof ContributorDTO) {
......@@ -346,6 +348,11 @@ public class CommonMetadataService extends AouService {
if (!contributorMap.isEmpty()) {
contributors.add(contributorMap);
// Index all contributors except directors in a dedicated index field. Useful for bibliography generator.
if (!contributorMap.containsKey("role") || !AouConstants.CONTRIBUTOR_ROLE_DIRECTOR.equals(contributorMap.get("role"))) {
contributorsWithoutDirectors.add(contributorMap);
}
}
}
......@@ -360,6 +367,10 @@ public class CommonMetadataService extends AouService {
if (!contributorsWithOtherNames.isEmpty()) {
properties.put("contributorsWithOtherNames", contributorsWithOtherNames);
}
if (!contributorsWithoutDirectors.isEmpty()) {
properties.put("contributorsWithoutDirectors", contributorsWithoutDirectors);
}
}
private Map<String, String> getContributorMap(ContributorDTO contributorDTO) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment