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
6a64cd9c
Commit
6a64cd9c
authored
Sep 21, 2017
by
apoorvnaik
Committed by
Madhan Neethiraj
Sep 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2151: fix incorrect handling of OR condition in index query
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
944a99b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
5 deletions
+10
-5
SearchProcessor.java
...main/java/org/apache/atlas/discovery/SearchProcessor.java
+10
-5
No files found.
repository/src/main/java/org/apache/atlas/discovery/SearchProcessor.java
View file @
6a64cd9c
...
@@ -366,7 +366,8 @@ public abstract class SearchProcessor {
...
@@ -366,7 +366,8 @@ public abstract class SearchProcessor {
}
}
private
String
toIndexQuery
(
AtlasStructType
type
,
FilterCriteria
criteria
,
Set
<
String
>
indexAttributes
,
StringBuilder
sb
,
int
level
)
{
private
String
toIndexQuery
(
AtlasStructType
type
,
FilterCriteria
criteria
,
Set
<
String
>
indexAttributes
,
StringBuilder
sb
,
int
level
)
{
if
(
criteria
.
getCondition
()
!=
null
&&
CollectionUtils
.
isNotEmpty
(
criteria
.
getCriterion
()))
{
Condition
condition
=
criteria
.
getCondition
();
if
(
condition
!=
null
&&
CollectionUtils
.
isNotEmpty
(
criteria
.
getCriterion
()))
{
StringBuilder
nestedExpression
=
new
StringBuilder
();
StringBuilder
nestedExpression
=
new
StringBuilder
();
for
(
FilterCriteria
filterCriteria
:
criteria
.
getCriterion
())
{
for
(
FilterCriteria
filterCriteria
:
criteria
.
getCriterion
())
{
...
@@ -374,16 +375,20 @@ public abstract class SearchProcessor {
...
@@ -374,16 +375,20 @@ public abstract class SearchProcessor {
if
(
StringUtils
.
isNotEmpty
(
nestedQuery
))
{
if
(
StringUtils
.
isNotEmpty
(
nestedQuery
))
{
if
(
nestedExpression
.
length
()
>
0
)
{
if
(
nestedExpression
.
length
()
>
0
)
{
nestedExpression
.
append
(
SPACE_STRING
).
append
(
c
riteria
.
getCondition
()
).
append
(
SPACE_STRING
);
nestedExpression
.
append
(
SPACE_STRING
).
append
(
c
ondition
).
append
(
SPACE_STRING
);
}
}
nestedExpression
.
append
(
nestedQuery
);
nestedExpression
.
append
(
nestedQuery
);
}
}
}
}
if
(
level
==
0
)
{
boolean
needSurroundingBraces
=
level
!=
0
||
(
condition
==
Condition
.
OR
&&
criteria
.
getCriterion
().
size
()
>
1
);
return
nestedExpression
.
length
()
>
0
?
sb
.
append
(
nestedExpression
).
toString
()
:
EMPTY_STRING
;
if
(
nestedExpression
.
length
()
>
0
)
{
return
sb
.
append
(
needSurroundingBraces
?
BRACE_OPEN_STR
:
EMPTY_STRING
)
.
append
(
nestedExpression
)
.
append
(
needSurroundingBraces
?
BRACE_CLOSE_STR
:
EMPTY_STRING
)
.
toString
();
}
else
{
}
else
{
return
nestedExpression
.
length
()
>
0
?
sb
.
append
(
BRACE_OPEN_STR
).
append
(
nestedExpression
).
append
(
BRACE_CLOSE_STR
).
toString
()
:
EMPTY_STRING
;
return
EMPTY_STRING
;
}
}
}
else
if
(
indexAttributes
.
contains
(
criteria
.
getAttributeName
())){
}
else
if
(
indexAttributes
.
contains
(
criteria
.
getAttributeName
())){
return
toIndexExpression
(
type
,
criteria
.
getAttributeName
(),
criteria
.
getOperator
(),
criteria
.
getAttributeValue
());
return
toIndexExpression
(
type
,
criteria
.
getAttributeName
(),
criteria
.
getOperator
(),
criteria
.
getAttributeValue
());
...
...
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