Skip to content

Commit a66e701

Browse files
committed
Merge pull request #50 from KangYongKyun/master
( ( A and B ) or C ) and ( D or E ) case is converted to ( ( A and B) and C ) and ( D or E ). that's wrong
2 parents d3077bb + 22b43a8 commit a66e701

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ private void parseWhere(SQLBinaryOpExpr expr, SQLBinaryOpExpr sub, Where where)
103103
if (isCond(sub)) {
104104
explanCond(expr.operator.name, sub, where);
105105
} else {
106-
if (sub.operator.priority > expr.operator.priority) {
106+
if (sub.operator.priority != expr.operator.priority) {
107107
Where subWhere = new Where(expr.getOperator().name);
108108
where.addWhere(subWhere);
109109
parseWhere(sub, subWhere);

src/test/java/org/nlpcn/es4sql/QueryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ public void testMultipartWhere() throws IOException, SqlParseException, SQLFeatu
413413
@Test
414414
public void testMultipartWhere2() throws IOException, SqlParseException, SQLFeatureNotSupportedException{
415415
SearchHits response = query(String.format("SELECT * FROM %s/account where ((account_number > 200 and account_number < 300) or gender like 'm') and (state like 'hi' or address like 'avenue')", TEST_INDEX));
416-
Assert.assertEquals(11, response.getTotalHits());
416+
Assert.assertEquals(127, response.getTotalHits());
417417
}
418418

419419
@Test

0 commit comments

Comments
 (0)