Commit 1fcef5be authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

Merge branch 'v4.x-master' into 'v5.x-master'

441: Fix issues related to deployment of upcoming v4-release (OPENED)

See merge request !42
parents 7c9555ef 9bae0fb1
Pipeline #26406 passed with stage
in 38 seconds
......@@ -9,7 +9,7 @@ allprojects {
apply plugin: 'eclipse'
group = 'eu.dariah.de.minfba'
version = '4.3.9-SNAPSHOT'
version = '4.3.12-SNAPSHOT'
repositories {
mavenLocal()
......@@ -18,7 +18,7 @@ allprojects {
}
}
ext {
coreVersion = "6.5.3-SNAPSHOT"
coreVersion = "6.5.4-SNAPSHOT"
gtfVersion = "2.3.3-SNAPSHOT"
processingVersion = "4.3.4-SNAPSHOT"
colregModelVersion = "4.4.1-SNAPSHOT"
......
......@@ -26,7 +26,6 @@ import eu.dariah.de.search.query.Query;
import eu.dariah.de.search.query.SimpleQuery;
import eu.dariah.de.search.query.SimpleQueryImpl;
import eu.dariah.de.search.query.execution.AggregationService;
import eu.dariah.de.search.query.execution.QueryExecutionServiceImpl;
import eu.dariah.de.search.query.results.QueryResult;
import eu.dariah.de.search.service.CustomSearchService;
import eu.dariah.de.search.service.DatamodelService;
......
......@@ -56,14 +56,14 @@ public abstract class BaseSearchController extends BaseController {
protected String getCollectionSelectionDialog(@RequestBody JsonNode body, List<Collection> availableCollections, Locale locale, Model model, HttpServletRequest request) {
ArrayNode sourceIdsNode = (ArrayNode) body.path("sourceIds");
List<String> sourceIds = new ArrayList<String>();
List<String> sourceIds = new ArrayList<>();
for (int i=0; i<sourceIdsNode.size(); i++) {
sourceIds.add(sourceIdsNode.get(i).textValue());
}
model.addAttribute("collections", collectionConverter.convert(availableCollections, locale));
model.addAttribute("preselectedCollIds", sourceIds);
model.addAttribute("preselectAll", sourceIds.size()==0);
model.addAttribute("preselectAll", sourceIds.isEmpty());
return "search/sourceSelectionForm";
}
......@@ -75,16 +75,15 @@ public abstract class BaseSearchController extends BaseController {
Map<String, String> collectionIdMap = collections.stream().collect(Collectors.toMap(Collection::getColregEntityId, Collection::getId));
for (int i=0; i<sourceIds.size(); i++) {
if (!collectionIdMap.containsKey(sourceIds.get(i))) {
if (!notifications.contains("~eu.dariah.de.minfba.search.view.notifications.selected_collection_unknown")) {
notifications.add("~eu.dariah.de.minfba.search.view.notifications.selected_collection_unknown");
}
continue;
}
if (strSourceId.length()>1) {
strSourceId.append(",");
}
strSourceId.append("\"").append(collectionIdMap.get(sourceIds.get(i))).append("\"");
if (collectionIdMap.containsKey(sourceIds.get(i))) {
strSourceId.append("\"").append(collectionIdMap.get(sourceIds.get(i))).append("\"");
} else {
strSourceId.append("\"").append("cid:" + sourceIds.get(i)).append("\"");
}
}
}
......
......@@ -7,6 +7,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.text.Text;
import org.elasticsearch.index.query.QueryBuilder;
......@@ -42,6 +44,7 @@ import eu.dariah.de.search.query.results.QueryResult;
import eu.dariah.de.search.query.results.QueryResultDatasource;
import eu.dariah.de.search.query.results.ResultElement;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.asm.Advice.This;
import eu.dariah.de.search.query.results.QueryResult.SearchTypes;
@Slf4j
......@@ -301,7 +304,7 @@ public class QueryExecutionServiceImpl extends BaseQueryService implements Query
if (responses==null) {
return;
}
Map<String, Long> datasourceCountMap = new HashMap<String, Long>();
Map<String, Long> datasourceCountMap = new HashMap<>();
for (SearchResponse resp : responses) {
if (resp==null || resp.getAggregations()==null) {
......@@ -328,9 +331,14 @@ public class QueryExecutionServiceImpl extends BaseQueryService implements Query
}
}
List<QueryResultDatasource> resultProviders = new ArrayList<QueryResultDatasource>();
List<String> unknownSourceIds = new ArrayList<>();
if (q.getSourceIds()!=null) {
unknownSourceIds.addAll(q.getSourceIds());
}
List<QueryResultDatasource> resultProviders = new ArrayList<>();
QueryResultDatasource qrd;
for (String datasourceId : datasourceCountMap.keySet()) {
for (String datasourceId : datasourceCountMap.keySet()) {
qrd = new QueryResultDatasource();
qrd.setHitCount(datasourceCountMap.get(datasourceId));
qrd.setLoadTags(qrd.getHitCount()>0);
......@@ -341,14 +349,37 @@ public class QueryExecutionServiceImpl extends BaseQueryService implements Query
qrd.setProviderName(collectionService.findById(datasourceId).getName("deu"));
}
resultProviders.add(qrd);
unknownSourceIds.remove(datasourceId);
}
// Resolve entries that were unknown before (still are in UI) and can be replaced with actual datasources now
Map<String, String> resolvedIdsMap = this.resolveUnknownExternalIds(unknownSourceIds);
for (Entry<String, String> resolvedIdsEntry : resolvedIdsMap.entrySet()) {
qrd = new QueryResultDatasource();
if (!resolvedIdsEntry.getKey().equals(resolvedIdsEntry.getValue())) {
qrd.setHitCount(datasourceCountMap.get(resolvedIdsEntry.getValue()));
qrd.setLoadTags(qrd.getHitCount()>0);
qrd.setProviderId(resolvedIdsEntry.getKey() + "~" + resolvedIdsEntry.getValue());
Collection ds = collectionService.findById(resolvedIdsEntry.getValue());
if (ds!=null) {
qrd.setProviderName(collectionService.findById(resolvedIdsEntry.getValue()).getName("deu"));
}
} else {
qrd.setHitCount(0);
qrd.setLoadTags(false);
qrd.setProviderName("unknown");
qrd.setProviderId(resolvedIdsEntry.getValue());
}
resultProviders.add(qrd);
}
Collections.sort(resultProviders);
qr.setResultDatasources(resultProviders);
}
private void addConfigInfo(Resource r, List<Element> elems) {
// This should never be the case! Why is it happening
if (elems==null) {
......@@ -375,3 +406,4 @@ public class QueryExecutionServiceImpl extends BaseQueryService implements Query
return false;
}
}
......@@ -17,6 +17,7 @@ import eu.dariah.de.search.Constants;
import eu.dariah.de.search.Constants.QueryTypes;
import eu.dariah.de.search.Constants.RootElementKeys;
import eu.dariah.de.search.es.service.SearchService;
import eu.dariah.de.search.model.Collection;
import eu.dariah.de.search.model.ExtendedMappingContainer;
import eu.dariah.de.search.query.ExtendedQuery;
import eu.dariah.de.search.query.Query;
......@@ -208,6 +209,24 @@ public abstract class BaseQueryService extends BaseResultService {
return this.wrapQueryBuilder(bqb, q);
}
protected Map<String, String> resolveUnknownExternalIds(List<String> sourceIds) {
Map<String, String> resolved = new HashMap<>(sourceIds.size());
Collection resolvedC;
for (String sourceId : sourceIds) {
if (sourceId.contains(":")) {
resolvedC = collectionService.findByColregEntityId(sourceId.substring(sourceId.indexOf(":")+1));
if (resolvedC!=null) {
resolved.put(sourceId, resolvedC.getId());
} else {
resolved.put(sourceId, sourceId);
}
} else {
resolved.put(sourceId, sourceId);
}
}
return resolved;
}
private QueryBuilder wrapQueryBuilder(QueryBuilder bldr, Query q) {
BoolQueryBuilder boolQb = null;
......@@ -227,7 +246,7 @@ public abstract class BaseQueryService extends BaseResultService {
}
if (q.getSourceIds()!=null && !q.getSourceIds().isEmpty()) {
boolQb.filter(QueryBuilders.termsQuery(Constants.ELEMENT_KEY_COLLECTION_ID, q.getSourceIds()));
boolQb.filter(QueryBuilders.termsQuery(Constants.ELEMENT_KEY_COLLECTION_ID, this.resolveUnknownExternalIds(q.getSourceIds()).values()));
}
}
......
......@@ -37,6 +37,10 @@ dependencies {
testCompileOnly "org.projectlombok:lombok"
}
springBoot {
buildInfo()
}
bootWar {
launchScript()
}
......
......@@ -55,7 +55,7 @@ public class WebConfig implements WebMvcConfigurer {
@PostConstruct
public void completeConfiguration() {
if (localization.getBaseNames()==null) {
localization.setBaseNames("classpath:i18n/messages","/themes/" + theme + "/i18n/theme");
localization.setBaseNames("/themes/" + theme + "/i18n/theme", "classpath:i18n/messages");
}
}
......
Subproject commit 535db34aba0eca1c26739a6aff3524772b14a089
Subproject commit cab8358d7ef4525e5d79ce56a58b2ffc4e3aac8e
......@@ -40,8 +40,8 @@
<c:if test="${navSubSubItem.iconClass!=null && fn:length(navSubSubItem.iconClass)>0}">
<i class="${navSubSubItem.iconClass}"></i>&nbsp;
</c:if>
<c:if test="${navSubItem.displayCode!=null && fn:length(navSubItem.displayCode)>0}">
<s:message code="${navSubItem.displayCode}" />
<c:if test="${navSubSubItem.displayCode!=null && fn:length(navSubSubItem.displayCode)>0}">
<s:message code="${navSubSubItem.displayCode}" />
</c:if>
</a>
</c:if>
......
Subproject commit d3f821ebc77887ef7a77fdd87425204ff1ce2023
Subproject commit 70bf0de987331734a4d17199655e4f8658a5a25c
Subproject commit 32e1d5ded7a30b738500748f2e07baeffb3019d3
Subproject commit a761a6234188333500aecf32bb0dabe946e2705c
Subproject commit be962398b220fc7fc2bfc7fd62c610ff33153391
Subproject commit e6a2eda558cc14639c280e7675d56eeeef76fb25
Subproject commit 90cbed2c64e2e6993daf2abeb92a56cdda27f3f2
Subproject commit 0391bf65650edc7fef658c5601d32508ce983c93
Subproject commit 1feafba0d8b4405dee29615c569d88f97c6ad723
Subproject commit a0b12779054b4a6f9128d7f49500f23b7211f0f5
Subproject commit b0a4a681cbfab4cee147432ead86a9dd4c271076
Subproject commit bffbb96dde2114c810ead39f0f8a7f31a053f8e8
Subproject commit 81e735c155cd5f5cb10a1197c8884439ee7b8baf
Subproject commit e0dc2ffbf9ed8ab57e37652f9ae1c073338c90a4
Subproject commit 43b0b3e9e428a3a19ac50333e33cfd077389c27b
Subproject commit a045dd9f2ce65f5005d4975f3e76dca774f411d4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment