Commit 54ef41b3 authored by Gradl, Tobias's avatar Gradl, Tobias
Browse files

1325: Return results from metasearch with regular queries

Task-Url: https://pm.winseda.de/issues/1325
parent 6eeb39f9
Pipeline #11905 failed with stages
in 7 seconds
......@@ -33,6 +33,7 @@ import de.unibamberg.minf.processing.model.base.Resource;
import de.unibamberg.minf.processing.model.serialization.ResourceSerializer;
import de.unibamberg.minf.processing.service.base.BaseResourceProcessingServiceImpl;
import de.unibamberg.minf.processing.service.xml.XmlProcessingService;
import eu.dariah.de.search.es.service.IndexingService;
import eu.dariah.de.search.indexing.model.ResourceContainer;
import eu.dariah.de.search.model.Collection;
import eu.dariah.de.search.model.Dataset;
......@@ -47,6 +48,7 @@ import eu.dariah.de.search.query.results.ResultElement;
import eu.dariah.de.search.query.results.QueryResult.ResultTypes;
import eu.dariah.de.search.service.CollectionService;
import eu.dariah.de.search.service.DatamodelService;
import eu.dariah.de.search.service.ResourceIndexingService;
import eu.dariah.de.search.service.MappingService;
import eu.dariah.de.search.transformation.ResourceEnrichmentService;
......@@ -131,8 +133,13 @@ public class SruQueryExecutionServiceImpl extends BaseResultService implements Q
XmlProcessingService processingSvc = appContext.getBean(XmlProcessingService.class);
ResourceEnrichmentService enrichmentService = appContext.getBean(ResourceEnrichmentService.class);
IndexingService indexingService = appContext.getBean(IndexingService.class);
indexingService.init(s.getIndexName(), s.getId(), c.getId(), opacEndpoint.getId());
processingSvc.setSchema(s.getModel());
processingSvc.addConsumptionService(enrichmentService);
try {
//processingSvc.setExecutionContext(new SessionExecutionContext(sessionsPath, session.getId()));
processingSvc.setRoot((Nonterminal)r);
......@@ -160,10 +167,13 @@ public class SruQueryExecutionServiceImpl extends BaseResultService implements Q
if (!enrichmentService.getResourceBatch().isEmpty()) {
indexingService.appendMetadata(enrichmentService.getResourceBatch());
indexingService.indexResources(enrichmentService.getResourceBatch());;
for (ResourceContainer rc : enrichmentService.getResourceBatch()) {
qr.getResultElements().add(this.renderResultElement(indexingObjectMapper.convertValue(rc.toSource(), JsonNode.class), c, s.getIndexName(), "", locale, 1, null, null, true, false));
qr.getResultElements().add(this.renderResultElement(indexingObjectMapper.convertValue(rc.toSource(), JsonNode.class), c, s.getIndexName(), rc.getId(), locale, 1, null, null, true, false));
}
}
......
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