Commit 27967fb9 authored by Oleksii Savran's avatar Oleksii Savran

Merge branch 'ui-706-missing-term-statistics-from-es' into 'master'

Fix: ES accession "images" with true/false instead of 1/0

See merge request genesys-pgr/genesys-server!543
parents fcc40420 e7944405
......@@ -522,8 +522,10 @@ public class AccessionServiceImpl implements AccessionService {
ElasticsearchService.TermResult suggestion = elasticsearchService.termStatisticsAuto(Accession.class, suggestionFilter, 100, suggestionKey);
if ("imageCount".equals(suggestionKey)) {
ElasticsearchService.Term falseTerm = suggestion.getTerms().stream().filter((term) -> "0".equals(term.getTerm())).findFirst().orElse(new ElasticsearchService.Term("0", 0));
ElasticsearchService.Term trueTerm = new ElasticsearchService.Term("1", suggestion.getTotalCount() - falseTerm.getCount());
// falseTerm: has "0" as imageCount
ElasticsearchService.Term falseTerm = suggestion.getTerms().stream().filter((term) -> "0".equals(term.getTerm())).findFirst().map((term) -> new ElasticsearchService.Term("false", term.getCount())).orElse(new ElasticsearchService.Term("false", 0));
// trueTerm: total - false
ElasticsearchService.Term trueTerm = new ElasticsearchService.Term("true", suggestion.getTotalCount() - falseTerm.getCount());
List<ElasticsearchService.Term> terms = Lists.newArrayList();
if(falseTerm.getCount() > 0) {
......
......@@ -29,7 +29,8 @@ log4j.rootLogger=error, stdout
log4j.category.org.genesys2=warn
log4j.category.org.genesys=warn
log4j.category.org.genesys2.server.api=warn
log4j.category.org.genesys.custom.elasticsearch=info
#log4j.category.org.genesys.custom.elasticsearch=info
#log4j.category.org.genesys2.server.service.impl.ElasticsearchServiceImpl=debug
#log4j.category.org.genesys2.server.service.impl.KPIServiceImpl=trace
log4j.category.org.genesys2.server.service.worker.KpiScheduledExecutor=info
log4j.category.liquibase=info
......
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