Dharshana M Krishnamoorthy created ATLAS-4568:
-------------------------------------------------
Summary: Basic search with tag filter gives approximateCount as -1
where there is no match and is 0 otherwise
Key: ATLAS-4568
URL: https://issues.apache.org/jira/browse/ATLAS-4568
Project: Atlas
Issue Type: Bug
Components: atlas-core
Reporter: Dharshana M Krishnamoorthy
*Scenario 1: faceted search with both tag filter and entity filter*
Payload with entity filter and tag filter
{code:java}
{
"excludeDeletedEntities": true,
"includeSubClassifications": true,
"includeSubTypes": true,
"includeClassificationAttributes": true,
"entityFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "name",
"operator": "contains",
"attributeValue": "zfmrp"
}, {
"attributeName": "clusterName",
"operator": "contains",
"attributeValue": "@cm"
}, {
"attributeName": "owner",
"operator": "neq",
"attributeValue": "hrt_qa"
}, {
"attributeName": "fileSize",
"operator": "gt",
"attributeValue": "-20000"
}]
},
"tagFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "string",
"operator": "neq",
"attributeValue": "str5"
}]
},
"attributes": ["clusterName", "fileSize"],
"limit": 25,
"offset": 0,
"typeName": "hdfs_path",
"classification": "tag_piakb_1",
"termName": null
}{code}
Post a basic search with with the above payload we get the following response
{code:java}
{
"queryType": "BASIC",
"searchParameters": {
"typeName": "hdfs_path",
"classification": "tag_piakb_1",
"excludeDeletedEntities": true,
"includeClassificationAttributes": true,
"includeSubTypes": true,
"includeSubClassifications": true,
"limit": 25,
"offset": 0,
"entityFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "name",
"operator": "contains",
"attributeValue": "zfmrp"
}, {
"attributeName": "clusterName",
"operator": "contains",
"attributeValue": "@cm"
}, {
"attributeName": "owner",
"operator": "!=",
"attributeValue": "hrt_qa"
}, {
"attributeName": "fileSize",
"operator": ">",
"attributeValue": "-20000"
}]
},
"tagFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "string",
"operator": "!=",
"attributeValue": "str5"
}]
},
"attributes": ["fileSize", "clusterName"]
},
"approximateCount": -1
} {code}
Here we can see the *approximateCount* is {*}-1{*}.
Here both entity filter and tag filter are present and when there is no match
we get *-1* in response
*Scenario 2: faceted search with only entity filter*
Payload with only entity filter
{code:java}
{
"excludeDeletedEntities": true,
"includeSubClassifications": true,
"includeSubTypes": true,
"includeClassificationAttributes": true,
"entityFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "name",
"operator": "contains",
"attributeValue": "zfmrp"
}, {
"attributeName": "clusterName",
"operator": "contains",
"attributeValue": "@cm"
}, {
"attributeName": "owner",
"operator": "neq",
"attributeValue": "hrt_qa"
}, {
"attributeName": "fileSize",
"operator": "gt",
"attributeValue": "-20000"
}]
},
"tagFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "string",
"operator": "neq",
"attributeValue": "str5"
}]
},
"attributes": ["clusterName", "fileSize"],
"limit": 25,
"offset": 0,
"typeName": "hdfs_path",
"classification": "tag_piakb_1",
"termName": null
} {code}
When we post a basic search we get the following response where the approximate
value is *0* when there is no match
{code:java}
{
"queryType": "BASIC",
"searchParameters": {
"typeName": "hdfs_path",
"classification": "tag_piakb_1",
"excludeDeletedEntities": true,
"includeClassificationAttributes": true,
"includeSubTypes": true,
"includeSubClassifications": true,
"limit": 25,
"offset": 0,
"entityFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "name",
"operator": "contains",
"attributeValue": "zfmrp"
}, {
"attributeName": "clusterName",
"operator": "contains",
"attributeValue": "@cm"
}, {
"attributeName": "owner",
"operator": "!=",
"attributeValue": "hrt_qa"
}, {
"attributeName": "fileSize",
"operator": ">",
"attributeValue": "-20000"
}]
},
"attributes": ["fileSize", "clusterName"]
},
"approximateCount": 0
} {code}
Scenario 3: Faceted search with only tag filter
Payload
{code:java}
{
"excludeDeletedEntities": true,
"includeSubClassifications": true,
"includeSubTypes": true,
"includeClassificationAttributes": true,
"entityFilters": null,
"tagFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "string",
"operator": "eq",
"attributeValue": "str5"
}]
},
"attributes": ["clusterName", "fileSize"],
"limit": 25,
"offset": 0,
"typeName": "hdfs_path",
"classification": "tag_piakb_1",
"termName": null
} {code}
Response
{code:java}
{
"queryType": "BASIC",
"searchParameters": {
"typeName": "hdfs_path",
"classification": "tag_piakb_1",
"excludeDeletedEntities": true,
"includeClassificationAttributes": true,
"includeSubTypes": true,
"includeSubClassifications": true,
"limit": 25,
"offset": 0,
"tagFilters": {
"condition": "AND",
"criterion": [{
"attributeName": "string",
"operator": "=",
"attributeValue": "str5"
}]
},
"attributes": ["fileSize", "clusterName"]
},
"approximateCount": -1
} {code}
When ever there is tag filter in the query and there is no entity match, then
the *approximateCount is -1* and if the tag filter is not there then the
response *approximateCount is 0*
*Cluster:*
*[https://quasar-hlokhs-1.quasar-hlokhs.root.hwx.site:31443|https://quasar-hlokhs-1.quasar-hlokhs.root.hwx.site:31443/]*
*Post url:*
*https://quasar-hlokhs-1.quasar-hlokhs.root.hwx.site:31443/api/atlas/v2/search/basic*
--
This message was sent by Atlassian Jira
(v8.20.1#820001)