Commit f03322a6 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch...

Merge branch 'ui-394-value-of-accessions-are-different-on-the-institute-page-and-accession-browser' into 'master'

Fixed elastic count of accessions

Closes genesys-ui#394

See merge request genesys-pgr/genesys-server!427
parents c3a6d08d 5f3af4fa
......@@ -5,7 +5,9 @@ import static org.elasticsearch.index.query.QueryBuilders.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MatchQueryBuilder;
......@@ -39,6 +41,8 @@ public class ElasticQueryBuilder implements Visitor<Void, Void> {
private final List<QueryBuilder> mustClauses = new ArrayList<>();
private final List<QueryBuilder> mustNotClauses = new ArrayList<>();
private final Map<String, RangeQueryBuilder> ranges = new HashMap<>();
private final ElasticQueryBuilder self = this;
......@@ -180,7 +184,15 @@ public class ElasticQueryBuilder implements Visitor<Void, Void> {
private void handleRange(Operator operator, Path<?> path, Expression<?> val1, Expression<?> val2) {
PathMetadata pmd = path.getMetadata();
RangeQueryBuilder rq = rangeQuery(customizedPath(pmd.getParent().toString() + "." + pmd.getName()));
RangeQueryBuilder rq;
if (ranges.get(path.toString()) != null) {
rq = ranges.get(path.toString());
} else {
rq = rangeQuery(customizedPath(pmd.getParent().toString() + "." + pmd.getName()));
ranges.put(path.toString(), rq);
}
if (operator == Ops.LOE) {
rq.lte(toValue(val1));
} else if (operator == Ops.LT) {
......
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