This is an automated email from the ASF dual-hosted git repository.

sarath pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/atlas.git


The following commit(s) were added to refs/heads/master by this push:
     new d528d27  ATLAS-3510: Enable quick-search and suggestions on entity 
labels
d528d27 is described below

commit d528d27574ee1affbf615f7a537b160459297458
Author: Sarath Subramanian <sar...@apache.org>
AuthorDate: Tue Nov 5 22:11:50 2019 -0800

    ATLAS-3510: Enable quick-search and suggestions on entity labels
---
 .../java/org/apache/atlas/repository/graph/SolrIndexHelper.java   | 8 +++++++-
 .../atlas/repository/store/graph/v2/EntityGraphRetriever.java     | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/repository/src/main/java/org/apache/atlas/repository/graph/SolrIndexHelper.java
 
b/repository/src/main/java/org/apache/atlas/repository/graph/SolrIndexHelper.java
index 7310861..4ec0086 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/graph/SolrIndexHelper.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/graph/SolrIndexHelper.java
@@ -36,6 +36,8 @@ import java.util.*;
 
 import static 
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.DEFAULT_SEARCHWEIGHT;
 import static org.apache.atlas.repository.Constants.CLASSIFICATION_TEXT_KEY;
+import static 
org.apache.atlas.repository.Constants.CUSTOM_ATTRIBUTES_PROPERTY_KEY;
+import static org.apache.atlas.repository.Constants.LABELS_PROPERTY_KEY;
 import static org.apache.atlas.repository.Constants.TYPE_NAME_PROPERTY_KEY;
 
 /**
@@ -48,6 +50,8 @@ public class SolrIndexHelper implements IndexChangeListener {
 
     public static final int DEFAULT_SEARCHWEIGHT_FOR_STRINGS = 3;
     public static final int SEARCHWEIGHT_FOR_CLASSIFICATIONS = 10;
+    public static final int SEARCHWEIGHT_FOR_LABELS          = 10;
+    public static final int SEARCHWEIGHT_FOR_CUSTOM_ATTRS    = 3;
     public static final int SEARCHWEIGHT_FOR_TYPENAME        = 1;
 
     private static final int MIN_SEARCH_WEIGHT_FOR_SUGGESTIONS = 8;
@@ -116,10 +120,12 @@ public class SolrIndexHelper implements 
IndexChangeListener {
         Map<String, Integer>        ret         = new HashMap<>();
         Collection<AtlasEntityType> entityTypes = 
typeRegistry.getAllEntityTypes();
 
-        //the following two properties are specially added manually.
+        //the following properties are specially added manually.
         //as, they don't come in the entity definitions as attributes.
 
         ret.put(typeRegistry.getIndexFieldName(CLASSIFICATION_TEXT_KEY), 
SEARCHWEIGHT_FOR_CLASSIFICATIONS);
+        ret.put(typeRegistry.getIndexFieldName(LABELS_PROPERTY_KEY), 
SEARCHWEIGHT_FOR_LABELS);
+        
ret.put(typeRegistry.getIndexFieldName(CUSTOM_ATTRIBUTES_PROPERTY_KEY), 
SEARCHWEIGHT_FOR_CUSTOM_ATTRS);
         ret.put(typeRegistry.getIndexFieldName(TYPE_NAME_PROPERTY_KEY), 
SEARCHWEIGHT_FOR_TYPENAME);
 
         if (!CollectionUtils.isNotEmpty(entityTypes)) {
diff --git 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
index 7853dc1..6b11173 100644
--- 
a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
+++ 
b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
@@ -501,6 +501,7 @@ public class EntityGraphRetriever {
         ret.setStatus(GraphHelper.getStatus(entityVertex));
         ret.setClassificationNames(getAllTraitNames(entityVertex));
         ret.setIsIncomplete(isIncomplete);
+        ret.setLabels(getLabels(entityVertex));
 
         List<AtlasTermAssignmentHeader> termAssignmentHeaders = 
mapAssignedTerms(entityVertex);
         ret.setMeanings(termAssignmentHeaders);

Reply via email to