You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by sa...@apache.org on 2019/11/06 07:12:57 UTC
[atlas] branch branch-2.0 updated: ATLAS-3510: Enable quick-search
and suggestions on entity labels
This is an automated email from the ASF dual-hosted git repository.
sarath pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new bb9279f ATLAS-3510: Enable quick-search and suggestions on entity labels
bb9279f is described below
commit bb9279f4eff89f34ff6b4db4a56f18ccf9a39f40
Author: Sarath Subramanian <sa...@apache.org>
AuthorDate: Tue Nov 5 22:11:50 2019 -0800
ATLAS-3510: Enable quick-search and suggestions on entity labels
(cherry picked from commit d528d27574ee1affbf615f7a537b160459297458)
---
.../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);