#743 - Fix issue with ElasticSearch nested path query with multiple nested path expressions

This commit is contained in:
Robin Bygrave committed 2016-06-20 20:57:45 +12:00
1 parent 6bbf93aba8
commit 3477f590dd
23 files changed
+742 -6

No files matched your search

@@ -45,9 +45,9 @@ abstract class LogicExpression implements SpiExpression {
}
}
protected final SpiExpression expOne;
protected SpiExpression expOne;
protected final SpiExpression expTwo;
protected SpiExpression expTwo;
private final String joinType;
@@ -67,6 +67,27 @@ abstract class LogicExpression implements SpiExpression {
context.endBool();
}
@Override
public String nestedPath(BeanDescriptor<?> desc) {
String pathOne = expOne.nestedPath(desc);
String pathTwo = expTwo.nestedPath(desc);
if (pathOne == null && pathTwo == null) {
return null;
}
if (pathOne != null && pathOne.equals(pathTwo)) {
return pathOne;
}
if (pathOne != null) {
expOne = new NestedPathWrapperExpression(pathOne, expOne);
}
if (pathTwo != null) {
expTwo = new NestedPathWrapperExpression(pathTwo, expTwo);
}
return null;
}
@Override
public void containsMany(BeanDescriptor<?> desc, ManyWhereJoins manyWhereJoin) {
expOne.containsMany(desc, manyWhereJoin);