Skip to content

Commit

Permalink
Initialize more things all at once
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-sammons committed Oct 1, 2024
1 parent c29fc18 commit 8b96df2
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,11 @@ public static AstraSearch.SearchRequest.SearchAggregation.FiltersAggregation toF

public static SearchQuery fromSearchRequest(AstraSearch.SearchRequest searchRequest) {
QueryBuilder queryBuilder = null;
SearchModule searchModule = new SearchModule(Settings.EMPTY, List.of());
NamedXContentRegistry namedXContentRegistry =
new NamedXContentRegistry(searchModule.getNamedXContents());
if (!searchRequest.getQuery().isEmpty()) {
SearchModule searchModule = new SearchModule(Settings.EMPTY, List.of());
try {
NamedXContentRegistry namedXContentRegistry =
new NamedXContentRegistry(searchModule.getNamedXContents());
JsonXContentParser jsonXContentParser =
new JsonXContentParser(
namedXContentRegistry,
Expand All @@ -687,10 +687,7 @@ public static SearchQuery fromSearchRequest(AstraSearch.SearchRequest searchRequ

AggregatorFactories.Builder aggregatorFactoriesBuilder = null;
if (!searchRequest.getAggregationJson().isEmpty()) {
SearchModule searchModule = new SearchModule(Settings.EMPTY, List.of());
try {
NamedXContentRegistry namedXContentRegistry =
new NamedXContentRegistry(searchModule.getNamedXContents());
JsonXContentParser jsonXContentParser =
new JsonXContentParser(
namedXContentRegistry,
Expand Down

0 comments on commit 8b96df2

Please sign in to comment.