Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Genesys PGR
Genesys Backend
Commits
8b8ba80d
Commit
8b8ba80d
authored
Jun 13, 2019
by
Maxym Borodenko
Committed by
Matija Obreza
Jul 14, 2019
Browse files
Fix for ElasticQueryBuilder
parent
5b1ed5d5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/genesys2/server/component/elastic/ElasticQueryBuilder.java
View file @
8b8ba80d
...
...
@@ -7,6 +7,7 @@ import java.util.ArrayList;
import
java.util.Collection
;
import
java.util.List
;
import
com.querydsl.core.types.OperationImpl
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.MatchQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilder
;
...
...
@@ -102,21 +103,32 @@ public class ElasticQueryBuilder implements Visitor<Void, Void> {
expr
.
accept
(
self
,
null
);
}
}
else
if
(
operator
==
Ops
.
EQ
||
operator
==
Ops
.
IN
)
{
LOG
.
debug
(
"EQUALS: {}"
,
args
);
for
(
Expression
<?>
expr
:
args
)
{
printExpression
(
"EQUALS.. "
,
expr
);
if
(
Path
.
class
.
isAssignableFrom
(
args
.
get
(
0
).
getClass
()))
{
LOG
.
debug
(
"EQUALS: {}"
,
args
);
for
(
Expression
<?>
expr
:
args
)
{
printExpression
(
"EQUALS.. "
,
expr
);
}
Path
<?>
a0
=
(
Path
<?>)
args
.
get
(
0
);
Expression
<?>
a1
=
args
.
get
(
1
);
handleEquals
(
a0
,
a1
);
}
else
{
Path
<?>
path
=
(
Path
<?>)((
OperationImpl
)
args
.
get
(
0
)).
getArg
(
0
);
PathMetadata
pmd
=
path
.
getMetadata
();
mustNotClauses
.
add
(
existsQuery
(
customizedPath
(
pmd
.
getParent
().
toString
()
+
"."
+
pmd
.
getName
())));
}
Path
<?>
a0
=
(
Path
<?>)
args
.
get
(
0
);
Expression
<?>
a1
=
args
.
get
(
1
);
handleEquals
(
a0
,
a1
);
}
else
if
(
operator
==
Ops
.
LOE
||
operator
==
Ops
.
GOE
||
operator
==
Ops
.
BETWEEN
||
operator
==
Ops
.
LT
||
operator
==
Ops
.
GT
)
{
LOG
.
debug
(
"Range: {}"
,
args
);
for
(
Expression
<?>
expr
:
args
)
{
printExpression
(
"LOE.. "
,
expr
);
if
(
Path
.
class
.
isAssignableFrom
(
args
.
get
(
0
).
getClass
()))
{
LOG
.
debug
(
"Range: {}"
,
args
);
for
(
Expression
<?>
expr
:
args
)
{
printExpression
(
"LOE.. "
,
expr
);
}
Path
<?>
a0
=
(
Path
<?>)
args
.
get
(
0
);
handleRange
(
operator
,
a0
,
args
.
get
(
1
),
args
.
size
()
>
2
?
args
.
get
(
2
)
:
null
);
}
else
{
Path
<?>
path
=
(
Path
<?>)((
OperationImpl
)
args
.
get
(
0
)).
getArg
(
0
);
PathMetadata
pmd
=
path
.
getMetadata
();
mustClauses
.
add
(
existsQuery
(
customizedPath
(
pmd
.
getParent
().
toString
()
+
"."
+
pmd
.
getName
())));
}
Path
<?>
a0
=
(
Path
<?>)
args
.
get
(
0
);
handleRange
(
operator
,
a0
,
args
.
get
(
1
),
args
.
size
()
>
2
?
args
.
get
(
2
)
:
null
);
}
else
if
(
operator
==
Ops
.
STRING_CONTAINS
||
operator
==
Ops
.
STARTS_WITH
)
{
LOG
.
debug
(
"{}: {}"
,
operator
,
args
);
for
(
Expression
<?>
expr
:
args
)
{
...
...
@@ -141,7 +153,7 @@ public class ElasticQueryBuilder implements Visitor<Void, Void> {
Path
<?>
path
=
(
Path
<?>)
args
.
get
(
0
);
PathMetadata
pmd
=
path
.
getMetadata
();
mustClauses
.
add
(
existsQuery
(
customizedPath
(
pmd
.
getParent
().
toString
()
+
"."
+
pmd
.
getName
())));
}
else
if
(
operator
==
Ops
.
IS_NULL
)
{
}
else
if
(
operator
==
Ops
.
IS_NULL
||
operator
==
Ops
.
COL_IS_EMPTY
)
{
LOG
.
debug
(
"{}: {}"
,
operator
,
args
);
for
(
Expression
<?>
expr
:
args
)
{
printExpression
(
operator
+
".. "
,
expr
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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