Skip to content

Commit

Permalink
fixed search queries, es equals and endsWith, native search notContai…
Browse files Browse the repository at this point in the history
…ns query
  • Loading branch information
holashchand committed Nov 10, 2023
1 parent f34c790 commit bac3b8e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ private BoolQueryBuilder buildQuery(SearchQuery searchQuery) {
}
switch (operator) {
case eq:
query = query.must(QueryBuilders.matchPhraseQuery(field, value));
query = query.must(QueryBuilders.matchPhraseQuery(String.format("%s.keyword", field), value));
break;
case neq:
query = query.mustNot(QueryBuilders.matchPhraseQuery(field, value));
Expand Down Expand Up @@ -369,7 +369,7 @@ private BoolQueryBuilder buildQuery(SearchQuery searchQuery) {
query = query.must(QueryBuilders.matchPhrasePrefixQuery(field, value.toString()));
break;
case endsWith:
query = query.must(QueryBuilders.wildcardQuery(field, "*" + value));
query = query.must(QueryBuilders.wildcardQuery(String.format("%s.keyword", field), "*" + value));
break;
case notContains:
query = query.mustNot(QueryBuilders.matchPhraseQuery(field, value));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,22 @@ private GraphTraversal<Vertex, Vertex> getFilteredResultTraversal(
break;

case contains:
condition = (s1, s2) -> (s1.contains(s2));
condition = String::contains;
resultGraphTraversal = resultGraphTraversal.has(property,
new P<String>(condition, genericValue.toString()));
break;
case startsWith:
condition = (s1, s2) -> (s1.startsWith(s2));
condition = String::startsWith;
resultGraphTraversal = resultGraphTraversal.has(property,
new P<String>(condition, genericValue.toString()));
break;
case endsWith:
condition = (s1, s2) -> (s1.endsWith(s2));
condition = String::endsWith;
resultGraphTraversal = resultGraphTraversal.has(property,
new P<String>(condition, genericValue.toString()));
break;
case notContains:
condition = (s1, s2) -> (s1.contains(s2));
condition = (s1, s2) -> (!s1.contains(s2));
resultGraphTraversal = resultGraphTraversal.has(property,
new P<String>(condition, genericValue.toString()));
break;
Expand Down

0 comments on commit bac3b8e

Please sign in to comment.