Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
24830e6b
Commit
24830e6b
authored
6 years ago
by
Chengbing Liu
Committed by
apoorvnaik
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2816: Allow ignoring relationship in
EntityGraphRetriever for FullTextMapperV2 Signed-off-by:
apoorvnaik
<
apoorvnaik@apache.org
>
parent
52ef9e7f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
16 deletions
+27
-16
FullTextMapperV2.java
...a/org/apache/atlas/repository/graph/FullTextMapperV2.java
+17
-15
EntityGraphRetriever.java
...atlas/repository/store/graph/v2/EntityGraphRetriever.java
+10
-1
No files found.
repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapperV2.java
View file @
24830e6b
...
@@ -6,9 +6,9 @@
...
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* with the License. You may obtain a copy of the License at
*
*
<p>
*
http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
<p>
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...
@@ -53,16 +53,17 @@ public class FullTextMapperV2 {
...
@@ -53,16 +53,17 @@ public class FullTextMapperV2 {
private
static
final
String
FULL_TEXT_EXCLUDE_ATTRIBUTE_PROPERTY
=
"atlas.search.fulltext.type"
;
private
static
final
String
FULL_TEXT_EXCLUDE_ATTRIBUTE_PROPERTY
=
"atlas.search.fulltext.type"
;
private
final
EntityGraphRetriever
entityGraphRetriever
;
private
final
EntityGraphRetriever
entityGraphRetriever
;
private
final
Configuration
configuration
;
private
final
boolean
followReferences
;
private
final
boolean
followReferences
;
private
final
Map
<
String
,
Set
<
String
>>
excludeAttributesCache
=
new
HashMap
<>();
private
final
Map
<
String
,
Set
<
String
>>
excludeAttributesCache
=
new
HashMap
<>();
private
Configuration
APPLICATION_PROPERTIES
=
null
;
@Inject
@Inject
public
FullTextMapperV2
(
AtlasTypeRegistry
typeRegistry
,
Configuration
configuration
)
{
public
FullTextMapperV2
(
AtlasTypeRegistry
typeRegistry
,
Configuration
configuration
)
{
entityGraphRetriever
=
new
EntityGraphRetriever
(
typeRegistry
);
this
.
configuration
=
configuration
;
APPLICATION_PROPERTIES
=
configuration
;
followReferences
=
this
.
configuration
!=
null
&&
this
.
configuration
.
getBoolean
(
FULL_TEXT_FOLLOW_REFERENCES
,
false
);
followReferences
=
APPLICATION_PROPERTIES
!=
null
&&
APPLICATION_PROPERTIES
.
getBoolean
(
FULL_TEXT_FOLLOW_REFERENCES
,
false
);
// If followReferences = false then ignore relationship attr loading
entityGraphRetriever
=
new
EntityGraphRetriever
(
typeRegistry
,
!
followReferences
);
}
}
/**
/**
...
@@ -73,8 +74,8 @@ public class FullTextMapperV2 {
...
@@ -73,8 +74,8 @@ public class FullTextMapperV2 {
* @throws AtlasBaseException
* @throws AtlasBaseException
*/
*/
public
String
getIndexTextForClassifications
(
String
guid
,
List
<
AtlasClassification
>
classifications
)
throws
AtlasBaseException
{
public
String
getIndexTextForClassifications
(
String
guid
,
List
<
AtlasClassification
>
classifications
)
throws
AtlasBaseException
{
String
ret
=
null
;
String
ret
=
null
;
AtlasEntityWithExtInfo
entityWithExtInfo
=
getAndCacheEntity
(
guid
);
AtlasEntityWithExtInfo
entityWithExtInfo
=
getAndCacheEntity
(
guid
);
if
(
entityWithExtInfo
!=
null
)
{
if
(
entityWithExtInfo
!=
null
)
{
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
...
@@ -100,8 +101,8 @@ public class FullTextMapperV2 {
...
@@ -100,8 +101,8 @@ public class FullTextMapperV2 {
}
}
public
String
getIndexTextForEntity
(
String
guid
)
throws
AtlasBaseException
{
public
String
getIndexTextForEntity
(
String
guid
)
throws
AtlasBaseException
{
String
ret
=
null
;
String
ret
=
null
;
AtlasEntityWithExtInfo
entity
=
getAndCacheEntity
(
guid
);
AtlasEntityWithExtInfo
entity
=
getAndCacheEntity
(
guid
);
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
StringBuilder
sb
=
new
StringBuilder
();
StringBuilder
sb
=
new
StringBuilder
();
...
@@ -207,7 +208,8 @@ public class FullTextMapperV2 {
...
@@ -207,7 +208,8 @@ public class FullTextMapperV2 {
AtlasEntityWithExtInfo
entityWithExtInfo
=
context
.
getInstanceV2
(
guid
);
AtlasEntityWithExtInfo
entityWithExtInfo
=
context
.
getInstanceV2
(
guid
);
if
(
entityWithExtInfo
==
null
)
{
if
(
entityWithExtInfo
==
null
)
{
entityWithExtInfo
=
entityGraphRetriever
.
toAtlasEntityWithExtInfo
(
guid
);
// Only map ownedRef and relationship attr when follow references is set to true
entityWithExtInfo
=
entityGraphRetriever
.
toAtlasEntityWithExtInfo
(
guid
,
!
followReferences
);
if
(
entityWithExtInfo
!=
null
)
{
if
(
entityWithExtInfo
!=
null
)
{
context
.
cache
(
entityWithExtInfo
);
context
.
cache
(
entityWithExtInfo
);
...
@@ -230,9 +232,9 @@ public class FullTextMapperV2 {
...
@@ -230,9 +232,9 @@ public class FullTextMapperV2 {
if
(
excludeAttributesCache
.
containsKey
(
typeName
))
{
if
(
excludeAttributesCache
.
containsKey
(
typeName
))
{
ret
=
excludeAttributesCache
.
get
(
typeName
);
ret
=
excludeAttributesCache
.
get
(
typeName
);
}
else
if
(
APPLICATION_PROPERTIES
!=
null
)
{
}
else
if
(
configuration
!=
null
)
{
String
[]
excludeAttributes
=
APPLICATION_PROPERTIES
.
getStringArray
(
FULL_TEXT_EXCLUDE_ATTRIBUTE_PROPERTY
+
"."
+
String
[]
excludeAttributes
=
configuration
.
getStringArray
(
FULL_TEXT_EXCLUDE_ATTRIBUTE_PROPERTY
+
"."
+
typeName
+
"."
+
"attributes.exclude"
);
typeName
+
"."
+
"attributes.exclude"
);
if
(
ArrayUtils
.
isNotEmpty
(
excludeAttributes
))
{
if
(
ArrayUtils
.
isNotEmpty
(
excludeAttributes
))
{
ret
=
new
HashSet
<>(
Arrays
.
asList
(
excludeAttributes
));
ret
=
new
HashSet
<>(
Arrays
.
asList
(
excludeAttributes
));
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/EntityGraphRetriever.java
View file @
24830e6b
...
@@ -138,8 +138,15 @@ public final class EntityGraphRetriever {
...
@@ -138,8 +138,15 @@ public final class EntityGraphRetriever {
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
AtlasTypeRegistry
typeRegistry
;
private
final
boolean
ignoreRelationshipAttr
;
public
EntityGraphRetriever
(
AtlasTypeRegistry
typeRegistry
)
{
public
EntityGraphRetriever
(
AtlasTypeRegistry
typeRegistry
)
{
this
(
typeRegistry
,
false
);
}
public
EntityGraphRetriever
(
AtlasTypeRegistry
typeRegistry
,
boolean
ignoreRelationshipAttr
)
{
this
.
typeRegistry
=
typeRegistry
;
this
.
typeRegistry
=
typeRegistry
;
this
.
ignoreRelationshipAttr
=
ignoreRelationshipAttr
;
}
}
public
AtlasEntity
toAtlasEntity
(
String
guid
)
throws
AtlasBaseException
{
public
AtlasEntity
toAtlasEntity
(
String
guid
)
throws
AtlasBaseException
{
...
@@ -385,7 +392,9 @@ public final class EntityGraphRetriever {
...
@@ -385,7 +392,9 @@ public final class EntityGraphRetriever {
mapAttributes
(
entityVertex
,
entity
,
entityExtInfo
,
isMinExtInfo
);
mapAttributes
(
entityVertex
,
entity
,
entityExtInfo
,
isMinExtInfo
);
mapRelationshipAttributes
(
entityVertex
,
entity
);
if
(!
ignoreRelationshipAttr
)
{
// only map when really needed
mapRelationshipAttributes
(
entityVertex
,
entity
);
}
mapClassifications
(
entityVertex
,
entity
);
mapClassifications
(
entityVertex
,
entity
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment