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
4ed4ba15
Commit
4ed4ba15
authored
Feb 21, 2017
by
apoorvnaik
Committed by
Madhan Neethiraj
Feb 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1573: Full text mapping for Entity store V2
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
17a9aad0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
4 deletions
+48
-4
FullTextMapper.java
...ava/org/apache/atlas/repository/graph/FullTextMapper.java
+4
-4
AtlasEntityChangeNotifier.java
.../repository/store/graph/v1/AtlasEntityChangeNotifier.java
+44
-0
No files found.
repository/src/main/java/org/apache/atlas/repository/graph/FullTextMapper.java
View file @
4ed4ba15
...
...
@@ -17,9 +17,6 @@
*/
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
...
...
@@ -34,6 +31,9 @@ import org.apache.commons.lang.StringUtils;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
import
java.util.Map
;
public
class
FullTextMapper
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
FullTextMapper
.
class
);
...
...
@@ -45,7 +45,7 @@ public class FullTextMapper {
private
static
final
String
FULL_TEXT_DELIMITER
=
" "
;
FullTextMapper
(
TypedInstanceToGraphMapper
typedInstanceToGraphMapper
,
public
FullTextMapper
(
TypedInstanceToGraphMapper
typedInstanceToGraphMapper
,
GraphToTypedInstanceMapper
graphToTypedInstanceMapper
)
{
this
.
graphToTypedInstanceMapper
=
graphToTypedInstanceMapper
;
this
.
typedInstanceToGraphMapper
=
typedInstanceToGraphMapper
;
...
...
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityChangeNotifier.java
View file @
4ed4ba15
...
...
@@ -27,8 +27,17 @@ import org.apache.atlas.model.instance.AtlasEntityHeader;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.model.instance.EntityMutations.EntityOperation
;
import
org.apache.atlas.listener.EntityChangeListener
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.converters.AtlasInstanceConverter
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graph.DeleteHandler
;
import
org.apache.atlas.repository.graph.FullTextMapper
;
import
org.apache.atlas.repository.graph.GraphHelper
;
import
org.apache.atlas.repository.graph.GraphToTypedInstanceMapper
;
import
org.apache.atlas.repository.graph.TypedInstanceToGraphMapper
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.util.AtlasRepositoryConfiguration
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -49,12 +58,23 @@ public class AtlasEntityChangeNotifier {
private
final
Set
<
EntityChangeListener
>
entityChangeListeners
;
private
final
AtlasInstanceConverter
instanceConverter
;
private
final
FullTextMapper
fullTextMapper
;
@Inject
private
DeleteHandler
deleteHandler
;
@Inject
public
AtlasEntityChangeNotifier
(
Set
<
EntityChangeListener
>
entityChangeListeners
,
AtlasInstanceConverter
instanceConverter
)
{
this
.
entityChangeListeners
=
entityChangeListeners
;
this
.
instanceConverter
=
instanceConverter
;
// This is only needed for the Legacy FullTextMapper, once the V2 changes are in place this can be replaced/removed
AtlasGraphProvider
graphProvider
=
new
AtlasGraphProvider
();
GraphToTypedInstanceMapper
graphToTypedInstanceMapper
=
new
GraphToTypedInstanceMapper
(
graphProvider
);
TypedInstanceToGraphMapper
typedInstanceToGraphMapper
=
new
TypedInstanceToGraphMapper
(
graphToTypedInstanceMapper
,
deleteHandler
);
this
.
fullTextMapper
=
new
FullTextMapper
(
typedInstanceToGraphMapper
,
graphToTypedInstanceMapper
);
}
public
void
onEntitiesMutated
(
EntityMutationResponse
entityMutationResponse
)
throws
AtlasBaseException
{
...
...
@@ -70,18 +90,21 @@ public class AtlasEntityChangeNotifier {
if
(
CollectionUtils
.
isNotEmpty
(
createdEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
createdEntities
);
doFullTextMapping
(
createdEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
CREATE
);
}
if
(
CollectionUtils
.
isNotEmpty
(
updatedEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
updatedEntities
);
doFullTextMapping
(
updatedEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
UPDATE
);
}
if
(
CollectionUtils
.
isNotEmpty
(
partiallyUpdatedEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
partiallyUpdatedEntities
);
doFullTextMapping
(
partiallyUpdatedEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
PARTIAL_UPDATE
);
}
...
...
@@ -122,4 +145,24 @@ public class AtlasEntityChangeNotifier {
return
ret
;
}
private
void
doFullTextMapping
(
List
<
AtlasEntityHeader
>
atlasEntityHeaders
)
{
try
{
if
(!
AtlasRepositoryConfiguration
.
isFullTextSearchEnabled
())
{
return
;
}
}
catch
(
AtlasException
e
)
{
LOG
.
warn
(
"Unable to determine if FullText is disabled. Proceeding with FullText mapping"
);
}
for
(
AtlasEntityHeader
atlasEntityHeader
:
atlasEntityHeaders
)
{
AtlasVertex
atlasVertex
=
AtlasGraphUtilsV1
.
findByGuid
(
atlasEntityHeader
.
getGuid
());
try
{
String
fullText
=
fullTextMapper
.
mapRecursive
(
atlasVertex
,
true
);
GraphHelper
.
setProperty
(
atlasVertex
,
Constants
.
ENTITY_TEXT_PROPERTY_KEY
,
fullText
);
}
catch
(
AtlasException
e
)
{
LOG
.
error
(
"FullText mapping failed for Vertex[ guid = {} ]"
,
atlasEntityHeader
.
getGuid
());
}
}
}
}
\ No newline at end of file
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