Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c69f4d2

Browse files
committed
1 parent 7a11f6c commit c69f4d2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>org.nlpcn</groupId>
55
<artifactId>elasticsearch-sql</artifactId>
6-
<version>6.3.2.1</version>
6+
<version>6.3.2.2</version>
77
<packaging>jar</packaging>
88
<description>Query elasticsearch using SQL</description>
99
<name>elasticsearch-sql</name>

src/main/java/org/nlpcn/es4sql/parse/WhereParser.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,17 @@ private void explanCond(String opear, SQLExpr expr, Where where) throws SqlParse
243243
Object[] methodParametersValue = getMethodValuesWithSubQueries(method);
244244

245245
Condition condition = null;
246-
246+
// fix OPEAR
247+
Condition.OPEAR oper = Condition.OPEAR.methodNameToOpear.get(methodName);
248+
if (soExpr.getOperator() == SQLBinaryOperator.LessThanOrGreater || soExpr.getOperator() == SQLBinaryOperator.NotEqual) {
249+
oper = oper.negative();
250+
}
247251
if (isNested)
248-
condition = new Condition(Where.CONN.valueOf(opear), soExpr.getLeft().toString(), soExpr.getLeft(), Condition.OPEAR.methodNameToOpear.get(methodName), methodParametersValue, soExpr.getRight(), nestedType);
252+
condition = new Condition(Where.CONN.valueOf(opear), soExpr.getLeft().toString(), soExpr.getLeft(), oper, methodParametersValue, soExpr.getRight(), nestedType);
249253
else if (isChildren)
250-
condition = new Condition(Where.CONN.valueOf(opear), soExpr.getLeft().toString(), soExpr.getLeft(), Condition.OPEAR.methodNameToOpear.get(methodName), methodParametersValue, soExpr.getRight(), childrenType);
254+
condition = new Condition(Where.CONN.valueOf(opear), soExpr.getLeft().toString(), soExpr.getLeft(), oper, methodParametersValue, soExpr.getRight(), childrenType);
251255
else
252-
condition = new Condition(Where.CONN.valueOf(opear), soExpr.getLeft().toString(), soExpr.getLeft(), Condition.OPEAR.methodNameToOpear.get(methodName), methodParametersValue, soExpr.getRight(), null);
256+
condition = new Condition(Where.CONN.valueOf(opear), soExpr.getLeft().toString(), soExpr.getLeft(), oper, methodParametersValue, soExpr.getRight(), null);
253257

254258
where.addWhere(condition);
255259
methodAsOpear = true;

0 commit comments

Comments
 (0)