-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/62491/
-----------------------------------------------------------
Review request for atlas, Ashutosh Mestry, Madhan Neethiraj, and Sarath
Subramanian.
Bugs: ATLAS-2151
https://issues.apache.org/jira/browse/ATLAS-2151
Repository: atlas
Description
-------
While fixing the bugs surronding the index query generation, the case where
multiple filters on a single entity attribute are specified was not being
handled correctly. This would cause the index to return wrong results or a
smaller dataset.
level == 0 check in the constructIndexQuery led to this problem.
The fix is to encapsulate the entity filters index clauses within braces if
there are more than one attribute filters.
Diffs
-----
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
d5e39236
Diff: https://reviews.apache.org/r/62491/diff/1/
Testing
-------
mvn clean package -Pberkeley-elasticsearch works fine
Tested the REST call with following search parameters
```javascript
{
"typeName": "hive_table",
"excludeDeletedEntities": true,
"classification" : "",
"query": "",
"limit": 10,
"offset": 0,
"entityFilters": {
"condition": "AND",
"criterion": [
{
"attributeName": "createTime",
"operator": "neq",
"attributeValue": "1491248917103"
},
{
"attributeName": "name",
"operator": "eq",
"attributeValue": "testtable_0"
}
]
},
"tagFilters": null,
"attributes": ["createTime"]
}
{
"typeName": "hive_table",
"excludeDeletedEntities": true,
"classification" : "",
"query": "",
"limit": 10,
"offset": 0,
"entityFilters": {
"condition": "OR",
"criterion": [
{
"attributeName": "name",
"operator": "eq",
"attributeValue": "testtable_1"
},
{
"attributeName": "name",
"operator": "eq",
"attributeValue": "testtable_0"
}
]
},
"tagFilters": null,
"attributes": ["createTime"]
}
{
"typeName": "hive_table",
"excludeDeletedEntities": true,
"classification" : "",
"query": "",
"limit": 10,
"offset": 0,
"entityFilters": {
"attributeName": "createTime",
"operator": "neq",
"attributeValue": "1491248917103"
},
"tagFilters": null,
"attributes": ["createTime"]
}
```
Verified from logs that the index query is enclosed within braces for
multi-filter attribute query and not when there's only one attribute (single)
filter
Verified the results from REST calls (as UI doesn't support this use case)
Thanks,
Apoorv Naik