Commit 9c9eed27 by Madhan Neethiraj

ATLAS-3139: updated basic search to include relationship attributes as well in the result

parent a910609d
......@@ -744,19 +744,19 @@ public class AtlasStructType extends AtlasType {
this.inverseRefAttributeName = inverseRefAttribute;
this.relationshipEdgeDirection = AtlasRelationshipEdgeDirection.OUT;
switch (attributeType.getTypeCategory()) {
switch (this.attributeType.getTypeCategory()) {
case OBJECT_ID_TYPE:
isObjectRef = true;
break;
case MAP:
AtlasMapType mapType = (AtlasMapType) attributeType;
AtlasMapType mapType = (AtlasMapType) this.attributeType;
isObjectRef = mapType.getValueType().getTypeCategory() == OBJECT_ID_TYPE;
break;
case ARRAY:
AtlasArrayType arrayType = (AtlasArrayType) attributeType;
AtlasArrayType arrayType = (AtlasArrayType) this.attributeType;
isObjectRef = arrayType.getElementType().getTypeCategory() == OBJECT_ID_TYPE;
break;
......
......@@ -451,6 +451,10 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
for (String resultAttribute : resultAttributes) {
AtlasAttribute attribute = entityType.getAttribute(resultAttribute);
if (attribute == null) {
attribute = entityType.getRelationshipAttribute(resultAttribute, null);
}
if (attribute != null) {
AtlasType attributeType = attribute.getAttributeType();
......@@ -536,6 +540,10 @@ public class EntityDiscoveryService implements AtlasDiscoveryService {
AtlasAttribute attribute = entityType.getAttribute(relation);
if (attribute == null) {
attribute = entityType.getRelationshipAttribute(relation, null);
}
if (attribute != null) {
if (attribute.isObjectRef()) {
relation = attribute.getRelationshipEdgeLabel();
......
......@@ -533,7 +533,13 @@ public class EntityGraphRetriever {
continue;
}
Object attrValue = getVertexAttribute(entityVertex, entityType.getAttribute(nonQualifiedAttrName));
AtlasAttribute attribute = entityType.getAttribute(nonQualifiedAttrName);
if (attribute == null) {
attribute = entityType.getRelationshipAttribute(nonQualifiedAttrName, null);
}
Object attrValue = getVertexAttribute(entityVertex, attribute);
if (attrValue != null) {
ret.setAttribute(nonQualifiedAttrName, attrValue);
......
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