Skip to content

Commit

Permalink
Remove wrapping user query
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhilbonte21 committed Mar 22, 2024
1 parent 1437c84 commit 59a2ceb
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,9 @@ private void addPreFiltersToSearchQuery(SearchParams searchParams) {
Map<String, Object> allPreFiltersBoolClause = NewAuthorizerUtils.getPreFilterDsl(persona, purpose, actions);
mustClauseList.add(allPreFiltersBoolClause);

String dslString = searchParams.getQuery();
mustClauseList.add((Map<String, Object>) ((IndexSearchParams) searchParams).getDsl().get("query"));

/*String dslString = searchParams.getQuery();
JsonNode node = mapper.readTree(dslString);
JsonNode userQueryNode = node.get("query");
if (userQueryNode != null) {
Expand All @@ -1190,12 +1192,13 @@ private void addPreFiltersToSearchQuery(SearchParams searchParams) {
String userQueryBase64 = Base64.getEncoder().encodeToString(userQueryString.getBytes());
mustClauseList.add(getMap("wrapper", getMap("query", userQueryBase64)));
}
}*/

JsonNode updateQueryNode = mapper.valueToTree(getMap("bool", getMap("must", mustClauseList)));

((ObjectNode) node).set("query", updateQueryNode);
searchParams.setQuery(node.toString());
//((ObjectNode) node).set("query", updateQueryNode);
//searchParams.setQuery(node.toString());

RequestContext.get().endMetricRecord(addPreFiltersToSearchQueryMetric);

} catch (Exception e) {
Expand Down

0 comments on commit 59a2ceb

Please sign in to comment.