Commit 0cccec93 by Sarath Subramanian

ATLAS-1815: Basic search API might return fewer entities when excludeDeletedEntities=true

parent bbf93327
......@@ -324,6 +324,12 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
basicQuery += gremlinQueryProvider.getQuery(AtlasGremlinQuery.BASIC_SEARCH_TYPE_FILTER);
}
if (excludeDeletedEntities) {
bindings.put("state", Status.ACTIVE.toString());
basicQuery += gremlinQueryProvider.getQuery(AtlasGremlinQuery.BASIC_SEARCH_STATE_FILTER);
}
if (isGuidPrefixSearch) {
bindings.put("guid", attrValuePrefix + ".*");
......@@ -347,9 +353,6 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
if (firstElement instanceof AtlasVertex) {
for (Object element : queryResult) {
if (element instanceof AtlasVertex) {
if (skipDeletedEntities(excludeDeletedEntities, (AtlasVertex) element)) {
continue;
}
ret.addEntity(entityRetriever.toAtlasEntityHeader((AtlasVertex) element));
} else {
......
......@@ -69,6 +69,8 @@ public class AtlasGremlin2QueryProvider extends AtlasGremlinQueryProvider {
return ".has('__typeName', T.in, typeNames)";
case BASIC_SEARCH_CLASSIFICATION_FILTER:
return ".has('__traitNames', T.in, traitNames)";
case BASIC_SEARCH_STATE_FILTER:
return ".has('__state', state)";
case TO_RANGE_LIST:
return " [startIdx..<endIdx].toList()";
case GUID_PREFIX_FILTER:
......
......@@ -58,6 +58,7 @@ public abstract class AtlasGremlinQueryProvider {
// Discovery Queries
BASIC_SEARCH_TYPE_FILTER,
BASIC_SEARCH_CLASSIFICATION_FILTER,
BASIC_SEARCH_STATE_FILTER,
TO_RANGE_LIST,
GUID_PREFIX_FILTER
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment