Commit 8b8ba80d authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza
Browse files

Fix for ElasticQueryBuilder

parent 5b1ed5d5
......@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.querydsl.core.types.OperationImpl;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.MatchQueryBuilder;
import org.elasticsearch.index.query.QueryBuilder;
......@@ -102,21 +103,32 @@ public class ElasticQueryBuilder implements Visitor<Void, Void> {
expr.accept(self, null);
}
} else if (operator == Ops.EQ || operator == Ops.IN) {
LOG.debug("EQUALS: {}", args);
for (Expression<?> expr : args) {
printExpression("EQUALS.. ", expr);
if (Path.class.isAssignableFrom(args.get(0).getClass())) {
LOG.debug("EQUALS: {}", args);
for (Expression<?> expr : args) {
printExpression("EQUALS.. ", expr);
}
Path<?> a0 = (Path<?>) args.get(0);
Expression<?> a1 = args.get(1);
handleEquals(a0, a1);
} else {
Path<?> path = (Path<?>)((OperationImpl) args.get(0)).getArg(0);
PathMetadata pmd = path.getMetadata();
mustNotClauses.add(existsQuery(customizedPath(pmd.getParent().toString() + "." + pmd.getName())));
}
Path<?> a0 = (Path<?>) args.get(0);
Expression<?> a1 = args.get(1);
handleEquals(a0, a1);
} else if (operator == Ops.LOE || operator == Ops.GOE || operator == Ops.BETWEEN || operator == Ops.LT || operator == Ops.GT) {
LOG.debug("Range: {}", args);
for (Expression<?> expr : args) {
printExpression("LOE.. ", expr);
if (Path.class.isAssignableFrom(args.get(0).getClass())) {
LOG.debug("Range: {}", args);
for (Expression<?> expr : args) {
printExpression("LOE.. ", expr);
}
Path<?> a0 = (Path<?>) args.get(0);
handleRange(operator, a0, args.get(1), args.size() > 2 ? args.get(2) : null);
} else {
Path<?> path = (Path<?>)((OperationImpl) args.get(0)).getArg(0);
PathMetadata pmd = path.getMetadata();
mustClauses.add(existsQuery(customizedPath(pmd.getParent().toString() + "." + pmd.getName())));
}
Path<?> a0 = (Path<?>) args.get(0);
handleRange(operator, a0, args.get(1), args.size() > 2 ? args.get(2) : null);
} else if (operator == Ops.STRING_CONTAINS || operator == Ops.STARTS_WITH) {
LOG.debug("{}: {}", operator, args);
for (Expression<?> expr : args) {
......@@ -141,7 +153,7 @@ public class ElasticQueryBuilder implements Visitor<Void, Void> {
Path<?> path = (Path<?>) args.get(0);
PathMetadata pmd = path.getMetadata();
mustClauses.add(existsQuery(customizedPath(pmd.getParent().toString() + "." + pmd.getName())));
} else if (operator == Ops.IS_NULL) {
} else if (operator == Ops.IS_NULL || operator == Ops.COL_IS_EMPTY) {
LOG.debug("{}: {}", operator, args);
for (Expression<?> expr : args) {
printExpression(operator + ".. ", expr);
......
Supports Markdown
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