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
40081d48
Commit
40081d48
authored
Jun 07, 2019
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3269: fixed basic-search handing of search for entities with no-classication
parent
ab8b7564
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
4 deletions
+48
-4
ClassificationSearchProcessor.java
...apache/atlas/discovery/ClassificationSearchProcessor.java
+2
-2
EntitySearchProcessor.java
...ava/org/apache/atlas/discovery/EntitySearchProcessor.java
+2
-2
SearchPredicateUtil.java
.../main/java/org/apache/atlas/util/SearchPredicateUtil.java
+44
-0
No files found.
repository/src/main/java/org/apache/atlas/discovery/ClassificationSearchProcessor.java
View file @
40081d48
...
...
@@ -176,8 +176,8 @@ public class ClassificationSearchProcessor extends SearchProcessor {
entityGraphQueryTraitNames
=
graph
.
query
().
or
(
orConditions
);
entityPredicateTraitNames
=
PredicateUtils
.
andPredicate
(
SearchPredicateUtil
.
getIsNullPredicateGenerator
().
generatePredicate
(
TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
),
SearchPredicateUtil
.
getIsNullPredicateGenerator
().
generatePredicate
(
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
));
SearchPredicateUtil
.
getIsNull
OrEmpty
PredicateGenerator
().
generatePredicate
(
TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
),
SearchPredicateUtil
.
getIsNull
OrEmpty
PredicateGenerator
().
generatePredicate
(
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
));
}
else
{
orConditions
.
add
(
graph
.
query
().
createChildQuery
().
in
(
TRAIT_NAMES_PROPERTY_KEY
,
typeAndSubTypes
));
orConditions
.
add
(
graph
.
query
().
createChildQuery
().
in
(
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
,
typeAndSubTypes
));
...
...
repository/src/main/java/org/apache/atlas/discovery/EntitySearchProcessor.java
View file @
40081d48
...
...
@@ -103,8 +103,8 @@ public class EntitySearchProcessor extends SearchProcessor {
traitPredicate
=
PredicateUtils
.
orPredicate
(
SearchPredicateUtil
.
getNotEmptyPredicateGenerator
().
generatePredicate
(
TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
),
SearchPredicateUtil
.
getNotEmptyPredicateGenerator
().
generatePredicate
(
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
));
}
else
if
(
classificationType
==
MATCH_ALL_NOT_CLASSIFIED
)
{
traitPredicate
=
PredicateUtils
.
andPredicate
(
SearchPredicateUtil
.
getIsNullPredicateGenerator
().
generatePredicate
(
TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
),
SearchPredicateUtil
.
getIsNullPredicateGenerator
().
generatePredicate
(
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
));
traitPredicate
=
PredicateUtils
.
andPredicate
(
SearchPredicateUtil
.
getIsNull
OrEmpty
PredicateGenerator
().
generatePredicate
(
TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
),
SearchPredicateUtil
.
getIsNull
OrEmpty
PredicateGenerator
().
generatePredicate
(
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
,
null
,
List
.
class
));
}
else
{
traitPredicate
=
PredicateUtils
.
orPredicate
(
SearchPredicateUtil
.
getContainsAnyPredicateGenerator
().
generatePredicate
(
TRAIT_NAMES_PROPERTY_KEY
,
classificationTypeAndSubTypes
,
List
.
class
),
SearchPredicateUtil
.
getContainsAnyPredicateGenerator
().
generatePredicate
(
PROPAGATED_TRAIT_NAMES_PROPERTY_KEY
,
classificationTypeAndSubTypes
,
List
.
class
));
...
...
repository/src/main/java/org/apache/atlas/util/SearchPredicateUtil.java
View file @
40081d48
...
...
@@ -650,6 +650,50 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
VertexAttributePredicateGenerator
getIsNullOrEmptyPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getIsNullOrEmptyPredicateGenerator"
);
}
VertexAttributePredicateGenerator
ret
=
new
VertexAttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
final
String
attrName
,
final
Object
attrVal
,
final
Class
attrClass
)
{
final
Predicate
ret
;
if
(
attrName
==
null
||
attrClass
==
null
)
{
ret
=
ALWAYS_FALSE
;
}
else
{
ret
=
new
VertexAttributePredicate
(
attrName
,
attrClass
,
true
)
{
@Override
protected
boolean
compareValue
(
final
Object
vertexAttrVal
)
{
final
boolean
ret
;
if
(
vertexAttrVal
==
null
)
{
ret
=
true
;
}
else
if
(
vertexAttrVal
instanceof
Collection
)
{
ret
=
CollectionUtils
.
isEmpty
((
Collection
)
vertexAttrVal
);
}
else
if
(
vertexAttrVal
instanceof
String
)
{
ret
=
StringUtils
.
isEmpty
((
String
)
vertexAttrVal
);
}
else
{
ret
=
false
;
}
return
ret
;
}
};
}
return
ret
;
}
};
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== getIsNullOrEmptyPredicateGenerator"
);
}
return
ret
;
}
public
interface
VertexAttributePredicateGenerator
{
Predicate
generatePredicate
(
String
attrName
,
Object
attrVal
,
Class
attrClass
);
}
...
...
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