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
c04c0ab3
Commit
c04c0ab3
authored
5 years ago
by
Le Ma
Committed by
Madhan Neethiraj
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3491: search on parent tag doesn't return entities associated with children tags
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
6ad08536
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
16 deletions
+27
-16
ClassificationSearchProcessor.java
...apache/atlas/discovery/ClassificationSearchProcessor.java
+1
-1
SearchProcessor.java
...main/java/org/apache/atlas/discovery/SearchProcessor.java
+14
-13
TestEntitiesREST.java
.../java/org/apache/atlas/web/adapters/TestEntitiesREST.java
+12
-2
No files found.
repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
View file @
c04c0ab3
...
...
@@ -156,7 +156,7 @@ public class ClassificationSearchProcessor extends SearchProcessor {
StringBuilder
queryString
=
new
StringBuilder
();
graphIndexQueryBuilder
.
addActiveStateQueryFilter
(
queryString
);
graphIndexQueryBuilder
.
addTypeAndSubTypesQueryFilter
(
queryString
,
context
.
getSearchParameters
().
getClassification
()
);
graphIndexQueryBuilder
.
addTypeAndSubTypesQueryFilter
(
queryString
,
typeAndSubTypesQryStr
);
constructFilterQuery
(
queryString
,
classificationType
,
filterCriteria
,
indexAttributes
);
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
View file @
c04c0ab3
...
...
@@ -242,27 +242,28 @@ public abstract class SearchProcessor {
protected
void
filterWhiteSpaceClassification
(
List
<
AtlasVertex
>
entityVertices
)
{
if
(
CollectionUtils
.
isNotEmpty
(
entityVertices
))
{
boolean
hasExactMatch
=
false
;
Iterator
<
AtlasVertex
>
it
=
entityVertices
.
iterator
();
final
Iterator
<
AtlasVertex
>
it
=
entityVertices
.
iterator
();
final
Set
<
String
>
typeAndSubTypes
=
context
.
getClassificationTypes
();
while
(
it
.
hasNext
())
{
AtlasVertex
entityVertex
=
it
.
next
();
AtlasVertex
entityVertex
=
it
.
next
();
List
<
String
>
classificationNames
=
AtlasGraphUtilsV2
.
getClassificationNames
(
entityVertex
);
if
(
CollectionUtils
.
isNotEmpty
(
classificationNames
)
&&
classificationNames
.
contains
(
context
.
getClassificationType
().
getTypeName
()))
{
hasExactMatch
=
true
;
if
(
CollectionUtils
.
isNotEmpty
(
classificationNames
))
{
if
(
CollectionUtils
.
containsAny
(
classificationNames
,
typeAndSubTypes
))
{
continue
;
}
}
if
(
hasExactMatch
)
continue
;
List
<
String
>
propagatedClassificationNames
=
AtlasGraphUtilsV2
.
getPropagatedClassificationNames
(
entityVertex
)
;
classificationNames
=
AtlasGraphUtilsV2
.
getPropagatedClassificationNames
(
entityVertex
);
if
(
CollectionUtils
.
isNotEmpty
(
classificationNames
)
&&
classificationNames
.
contains
(
context
.
getClassificationType
().
getTypeName
()))
{
hasExactMatch
=
true
;
if
(
CollectionUtils
.
isNotEmpty
(
propagatedClassificationNames
))
{
if
(
CollectionUtils
.
containsAny
(
propagatedClassificationNames
,
typeAndSubTypes
))
{
continue
;
}
}
if
(!
hasExactMatch
)
{
it
.
remove
();
}
it
.
remove
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
webapp/src/test/java/org/apache/atlas/web/adapters/TestEntitiesREST.java
View file @
c04c0ab3
...
...
@@ -19,6 +19,7 @@ package org.apache.atlas.web.adapters;
import
static
org
.
apache
.
atlas
.
TestUtilsV2
.
COLUMN_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtilsV2
.
DATABASE_TYPE
;
import
static
org
.
apache
.
atlas
.
TestUtilsV2
.
FETL_CLASSIFICATION
;
import
static
org
.
apache
.
atlas
.
TestUtilsV2
.
PHI
;
import
static
org
.
apache
.
atlas
.
TestUtilsV2
.
TABLE_TYPE
;
...
...
@@ -334,18 +335,27 @@ public class TestEntitiesREST {
ClassificationAssociateRequest
clsAssRequest
=
new
ClassificationAssociateRequest
(
createdGuids
.
get
(
DATABASE_TYPE
),
fetlCls
);
entityREST
.
addClassification
(
clsAssRequest
);
final
AtlasClassification
result_tag
=
entityREST
.
getClassification
(
createdGuids
.
get
(
DATABASE_TYPE
).
get
(
0
),
TestUtilsV2
.
PHI
);
final
AtlasClassification
result_tag
=
entityREST
.
getClassification
(
createdGuids
.
get
(
DATABASE_TYPE
).
get
(
0
),
TestUtilsV2
.
FETL_CLASSIFICATION
);
Assert
.
assertNotNull
(
result_tag
);
Assert
.
assertEquals
(
result_tag
.
getTypeName
(),
FETL_CLASSIFICATION
);
// basic search with subtypes
searchParameters
=
new
SearchParameters
();
searchParameters
.
setClassification
(
TestUtilsV2
.
CLASSIFICATION
);
searchParameters
.
setIncludeSub
Type
s
(
true
);
searchParameters
.
setIncludeSub
Classification
s
(
true
);
AtlasSearchResult
res
=
discoveryREST
.
searchWithParameters
(
searchParameters
);
Assert
.
assertNotNull
(
res
.
getEntities
());
Assert
.
assertEquals
(
res
.
getEntities
().
size
(),
3
);
// basic search without subtypes
searchParameters
.
setIncludeSubClassifications
(
false
);
res
=
discoveryREST
.
searchWithParameters
(
searchParameters
);
Assert
.
assertNotNull
(
res
.
getEntities
());
Assert
.
assertEquals
(
res
.
getEntities
().
size
(),
2
);
}
@Test
(
dependsOnMethods
=
"testTagToMultipleEntities"
)
...
...
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