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
8 years ago
by
apoorvnaik
Committed by
Madhan Neethiraj
8 years ago
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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
5 deletions
+49
-5
FullTextMapper.java
...ava/org/apache/atlas/repository/graph/FullTextMapper.java
+5
-5
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 @@
...
@@ -17,9 +17,6 @@
*/
*/
package
org
.
apache
.
atlas
.
repository
.
graph
;
package
org
.
apache
.
atlas
.
repository
.
graph
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.AtlasException
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.RequestContext
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
import
org.apache.atlas.repository.graphdb.AtlasVertex
;
...
@@ -34,6 +31,9 @@ import org.apache.commons.lang.StringUtils;
...
@@ -34,6 +31,9 @@ import org.apache.commons.lang.StringUtils;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
import
java.util.Map
;
public
class
FullTextMapper
{
public
class
FullTextMapper
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
FullTextMapper
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
FullTextMapper
.
class
);
...
@@ -45,8 +45,8 @@ public class FullTextMapper {
...
@@ -45,8 +45,8 @@ public class FullTextMapper {
private
static
final
String
FULL_TEXT_DELIMITER
=
" "
;
private
static
final
String
FULL_TEXT_DELIMITER
=
" "
;
FullTextMapper
(
TypedInstanceToGraphMapper
typedInstanceToGraphMapper
,
public
FullTextMapper
(
TypedInstanceToGraphMapper
typedInstanceToGraphMapper
,
GraphToTypedInstanceMapper
graphToTypedInstanceMapper
)
{
GraphToTypedInstanceMapper
graphToTypedInstanceMapper
)
{
this
.
graphToTypedInstanceMapper
=
graphToTypedInstanceMapper
;
this
.
graphToTypedInstanceMapper
=
graphToTypedInstanceMapper
;
this
.
typedInstanceToGraphMapper
=
typedInstanceToGraphMapper
;
this
.
typedInstanceToGraphMapper
=
typedInstanceToGraphMapper
;
}
}
...
...
This diff is collapsed.
Click to expand it.
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;
...
@@ -27,8 +27,17 @@ import org.apache.atlas.model.instance.AtlasEntityHeader;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.model.instance.EntityMutationResponse
;
import
org.apache.atlas.model.instance.EntityMutations.EntityOperation
;
import
org.apache.atlas.model.instance.EntityMutations.EntityOperation
;
import
org.apache.atlas.listener.EntityChangeListener
;
import
org.apache.atlas.listener.EntityChangeListener
;
import
org.apache.atlas.repository.Constants
;
import
org.apache.atlas.repository.converters.AtlasInstanceConverter
;
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.typesystem.ITypedReferenceableInstance
;
import
org.apache.atlas.util.AtlasRepositoryConfiguration
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
@@ -49,12 +58,23 @@ public class AtlasEntityChangeNotifier {
...
@@ -49,12 +58,23 @@ public class AtlasEntityChangeNotifier {
private
final
Set
<
EntityChangeListener
>
entityChangeListeners
;
private
final
Set
<
EntityChangeListener
>
entityChangeListeners
;
private
final
AtlasInstanceConverter
instanceConverter
;
private
final
AtlasInstanceConverter
instanceConverter
;
private
final
FullTextMapper
fullTextMapper
;
@Inject
private
DeleteHandler
deleteHandler
;
@Inject
@Inject
public
AtlasEntityChangeNotifier
(
Set
<
EntityChangeListener
>
entityChangeListeners
,
public
AtlasEntityChangeNotifier
(
Set
<
EntityChangeListener
>
entityChangeListeners
,
AtlasInstanceConverter
instanceConverter
)
{
AtlasInstanceConverter
instanceConverter
)
{
this
.
entityChangeListeners
=
entityChangeListeners
;
this
.
entityChangeListeners
=
entityChangeListeners
;
this
.
instanceConverter
=
instanceConverter
;
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
{
public
void
onEntitiesMutated
(
EntityMutationResponse
entityMutationResponse
)
throws
AtlasBaseException
{
...
@@ -70,18 +90,21 @@ public class AtlasEntityChangeNotifier {
...
@@ -70,18 +90,21 @@ public class AtlasEntityChangeNotifier {
if
(
CollectionUtils
.
isNotEmpty
(
createdEntities
))
{
if
(
CollectionUtils
.
isNotEmpty
(
createdEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
createdEntities
);
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
createdEntities
);
doFullTextMapping
(
createdEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
CREATE
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
CREATE
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
updatedEntities
))
{
if
(
CollectionUtils
.
isNotEmpty
(
updatedEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
updatedEntities
);
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
updatedEntities
);
doFullTextMapping
(
updatedEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
UPDATE
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
UPDATE
);
}
}
if
(
CollectionUtils
.
isNotEmpty
(
partiallyUpdatedEntities
))
{
if
(
CollectionUtils
.
isNotEmpty
(
partiallyUpdatedEntities
))
{
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
partiallyUpdatedEntities
);
List
<
ITypedReferenceableInstance
>
typedRefInst
=
toITypedReferenceable
(
partiallyUpdatedEntities
);
doFullTextMapping
(
partiallyUpdatedEntities
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
PARTIAL_UPDATE
);
notifyListeners
(
typedRefInst
,
EntityOperation
.
PARTIAL_UPDATE
);
}
}
...
@@ -122,4 +145,24 @@ public class AtlasEntityChangeNotifier {
...
@@ -122,4 +145,24 @@ public class AtlasEntityChangeNotifier {
return
ret
;
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
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