The JOIN query does not support the multi_match function in the WHERE clause due to table alias missing. This limitation arises due to two primary reasons:
A validation step requires that the left side of the expression use a table alias.
The optimizer relies on the alias to determine which table should receive the filtering condition.
How can one reproduce the bug?
@Test
public void multiMatchQuerySingleField() throws IOException {
assertThat(
query(
"SELECT a.firstname",
FROM_ACCOUNTS + " AS a INNER JOIN " + TEST_INDEX_ACCOUNT + " AS b ON a.firstname = b.firstname",
"WHERE MULTI_MATCH('query'='Ayers', 'fields'='firstname')"),
hits(hasValueForFields("Ayers", "firstname")));
}
{
"error": {
"reason": "Invalid SQL query",
"details": "Field ['query' = 'Ayers'] with condition [AND 'query' = 'Ayers' EQ
MULTI_MATCH(com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr@101a1ce6,
com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr@b5dbbdc4)] does not contain an alias",
"type": "SqlParseException"
},
"status": 400
}
What is the expected behavior?
The JOIN query should support the multi_match function in the WHERE clause without problem.
What is the bug?
The
JOIN
query does not support the multi_match function in theWHERE
clause due to table alias missing. This limitation arises due to two primary reasons:How can one reproduce the bug?
What is the expected behavior?
The
JOIN
query should support the multi_match function in theWHERE
clause without problem.Do you have any additional context?
N/A