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
1b41b980
Commit
1b41b980
authored
4 years ago
by
chaitali borole
Committed by
kevalbhatt
4 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3892 : Basic search enhanced Feature - Search history
Signed-off-by:
kevalbhatt
<
kbhatt@apache.org
>
parent
83e9c21f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
0 deletions
+62
-0
Constants.java
.../src/main/java/org/apache/atlas/repository/Constants.java
+1
-0
SearchParameters.java
...va/org/apache/atlas/model/discovery/SearchParameters.java
+5
-0
SearchProcessor.java
...main/java/org/apache/atlas/discovery/SearchProcessor.java
+0
-0
SearchPredicateUtil.java
.../main/java/org/apache/atlas/util/SearchPredicateUtil.java
+56
-0
EntitySearchProcessorTest.java
...org/apache/atlas/discovery/EntitySearchProcessorTest.java
+0
-0
No files found.
common/src/main/java/org/apache/atlas/repository/Constants.java
View file @
1b41b980
...
...
@@ -188,6 +188,7 @@ public final class Constants {
public
static
final
String
TERM_ASSIGNMENT_LABEL
=
"r:AtlasGlossarySemanticAssignment"
;
public
static
final
String
ATTRIBUTE_INDEX_PROPERTY_KEY
=
encodePropertyKey
(
INTERNAL_PROPERTY_KEY_PREFIX
+
"index"
);
public
static
final
String
ATTRIBUTE_KEY_PROPERTY_KEY
=
encodePropertyKey
(
INTERNAL_PROPERTY_KEY_PREFIX
+
"key"
);
public
static
final
String
ATTRIBUTE_VALUE_DELIMITER
=
","
;
public
static
final
String
VERTEX_ID_IN_IMPORT_KEY
=
"__vIdInImport"
;
public
static
final
String
EDGE_ID_IN_IMPORT_KEY
=
"__eIdInImport"
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/model/discovery/SearchParameters.java
View file @
1b41b980
...
...
@@ -443,6 +443,10 @@ public class SearchParameters implements Serializable {
* Logical comparision operators can only be used with numbers or dates
* IN, LIKE, startsWith, endsWith, CONTAINS can only be used with strings or text
*/
/**
* NOTE : The names added in the String array should always contain first value in lower case
*/
public
enum
Operator
{
LT
(
new
String
[]{
"<"
,
"lt"
}),
GT
(
new
String
[]{
">"
,
"gt"
}),
...
...
@@ -460,6 +464,7 @@ public class SearchParameters implements Serializable {
CONTAINS_ALL
(
new
String
[]{
"containsAll"
,
"CONTAINSALL"
,
"contains_all"
,
"CONTAINS_ALL"
}),
IS_NULL
(
new
String
[]{
"isNull"
,
"ISNULL"
,
"is_null"
,
"IS_NULL"
}),
NOT_NULL
(
new
String
[]{
"notNull"
,
"NOTNULL"
,
"not_null"
,
"NOT_NULL"
}),
TIME_RANGE
(
new
String
[]{
"timerange"
,
"TIMERANGE"
,
"time_range"
,
"TIME_RANGE"
})
;
static
final
Map
<
String
,
Operator
>
operatorsMap
=
new
HashMap
<>();
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
View file @
1b41b980
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/util/SearchPredicateUtil.java
View file @
1b41b980
...
...
@@ -179,6 +179,40 @@ public class SearchPredicateUtil {
return
ret
;
}
public
static
ElementAttributePredicateGenerator
getInRangePredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getInRangePredicateGenerator"
);
}
ElementAttributePredicateGenerator
ret
=
new
ElementAttributePredicateGenerator
()
{
@Override
public
Predicate
generatePredicate
(
String
attrName
,
Object
attrVal
,
Class
attrClass
)
{
return
generatePredicate
(
attrName
,
attrVal
,
attrVal
,
attrClass
);
}
@Override
public
Predicate
generatePredicate
(
String
attrName
,
Object
attrVal
,
Object
attrVal2
,
Class
attrClass
)
{
final
Predicate
ret
;
if
(
attrName
==
null
||
attrClass
==
null
||
attrVal
==
null
||
attrVal2
==
null
)
{
ret
=
ALWAYS_FALSE
;
}
else
if
(
Long
.
class
.
isAssignableFrom
(
attrClass
))
{
ret
=
LongPredicate
.
getInRangePredicate
(
attrName
,
attrClass
,
(
Long
)
attrVal
,
(
Long
)
attrVal2
);
}
else
{
ret
=
ALWAYS_FALSE
;
}
return
ret
;
}
};
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== getInRangePredicateGenerator"
);
}
return
ret
;
}
public
static
ElementAttributePredicateGenerator
getGTEPredicateGenerator
()
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> getGTEPredicateGenerator"
);
...
...
@@ -768,6 +802,9 @@ public class SearchPredicateUtil {
public
interface
ElementAttributePredicateGenerator
{
Predicate
generatePredicate
(
String
attrName
,
Object
attrVal
,
Class
attrClass
);
default
Predicate
generatePredicate
(
String
attrName
,
Object
attrVal
,
Object
attrVal2
,
Class
attrClass
)
{
return
generatePredicate
(
attrName
,
attrVal
,
attrClass
);
}
}
static
abstract
class
ElementAttributePredicate
implements
Predicate
{
...
...
@@ -969,16 +1006,27 @@ public class SearchPredicateUtil {
static
abstract
class
LongPredicate
extends
ElementAttributePredicate
{
final
Long
value
;
final
Long
value2
;
LongPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
super
(
attrName
,
attrClass
);
this
.
value
=
value
;
this
.
value2
=
null
;
}
LongPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
,
Long
value2
,
boolean
isNullValid
)
{
super
(
attrName
,
attrClass
,
isNullValid
);
this
.
value
=
value
;
this
.
value2
=
value2
;
}
LongPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
,
boolean
isNullValid
)
{
super
(
attrName
,
attrClass
,
isNullValid
);
this
.
value
=
value
;
this
.
value2
=
null
;
}
static
ElementAttributePredicate
getEQPredicate
(
String
attrName
,
Class
attrClass
,
Long
value
)
{
...
...
@@ -1028,6 +1076,14 @@ public class SearchPredicateUtil {
}
};
}
static
ElementAttributePredicate
getInRangePredicate
(
String
attrName
,
Class
attrClass
,
Long
rangeStart
,
Long
rangeEnd
)
{
return
new
LongPredicate
(
attrName
,
attrClass
,
rangeStart
,
rangeEnd
,
false
)
{
protected
boolean
compareValue
(
Object
vertexAttrVal
)
{
return
((
Long
)
vertexAttrVal
).
compareTo
(
value
)
>=
0
&&
((
Long
)
vertexAttrVal
).
compareTo
(
value2
)
<=
0
;
}
};
}
}
static
abstract
class
FloatPredicate
extends
ElementAttributePredicate
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/test/java/org/apache/atlas/discovery/EntitySearchProcessorTest.java
View file @
1b41b980
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