Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kderusso committed Dec 10, 2024
1 parent 21d859f commit e52625b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ public final QueryBuilder rewrite(QueryRewriteContext queryRewriteContext) throw
return rewritten;
}
}

QueryBuilder rewritten = doRewrite(queryRewriteContext);
if (rewritten == this) {
return rewritten;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import java.util.Objects;

/**
* Wrapper for instances of {@link AbstractQueryBuilder} that have been intercepted using the {@link QueryRewriteInterceptor} to
* Wrapper for instances of {@link QueryBuilder} that have been intercepted using the {@link QueryRewriteInterceptor} to
* break out of the rewrite phase. These instances are unwrapped on serialization.
*/
public class InterceptedQueryBuilderWrapper implements QueryBuilder {
Expand All @@ -28,7 +28,11 @@ public class InterceptedQueryBuilderWrapper implements QueryBuilder {

public InterceptedQueryBuilderWrapper(QueryBuilder queryBuilder) {
super();
this.queryBuilder = queryBuilder;
if (queryBuilder instanceof InterceptedQueryBuilderWrapper) {
this.queryBuilder = ((InterceptedQueryBuilderWrapper) queryBuilder).queryBuilder;
} else {
this.queryBuilder = queryBuilder;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,37 +160,6 @@ public QueryRewriteContext(
);
}

/**
* Returns a new {@link QueryRewriteContext} instance that is stripped of any
* configured interceptors, guaranteeing that downstream rewrites don't try to
* re-intercept the query.
*/
public QueryRewriteContext getInterceptedQueryRewriteContext() {

if (queryRewriteInterceptor == null) {
return this;
}

return new QueryRewriteContext(
parserConfiguration,
client,
nowInMillis,
mapperService,
mappingLookup,
runtimeMappings,
indexSettings,
fullyQualifiedIndex,
indexNameMatcher,
writeableRegistry,
valuesSourceRegistry,
allowExpensiveQueries,
scriptService,
resolvedIndices,
pit,
null
);
}

/**
* The registry used to build new {@link XContentParser}s. Contains registered named parsers needed to parse the query.
*
Expand Down

0 comments on commit e52625b

Please sign in to comment.