Skip to content

Commit

Permalink
Address code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta committed Mar 4, 2022
1 parent 52ced88 commit 3eecdc4
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 @@ -79,20 +79,20 @@ public static class FilterScoreFunction extends ScoreFunction {
* @param function score function
*/
public FilterScoreFunction(Query filter, ScoreFunction function) {
this(filter, null, function);
this(filter, function, null);
}

/**
* Creates a FilterScoreFunction with query and function.
* @param filter filter query
* @param queryName filter query name
* @param function score function
* @param queryName filter query name
*/
public FilterScoreFunction(Query filter, @Nullable String queryName, ScoreFunction function) {
public FilterScoreFunction(Query filter, ScoreFunction function, @Nullable String queryName) {
super(function.getDefaultScoreCombiner());
this.filter = filter;
this.queryName = queryName;
this.function = function;
this.queryName = queryName;
}

@Override
Expand Down Expand Up @@ -127,7 +127,7 @@ protected ScoreFunction rewrite(IndexReader reader) throws IOException {
if (newFilter == filter) {
return this;
}
return new FilterScoreFunction(newFilter, queryName, function);
return new FilterScoreFunction(newFilter, function, queryName);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ protected Query doToQuery(QueryShardContext context) throws IOException {
filterFunctions[i++] = scoreFunction;
} else {
Query filter = builder.toQuery(context);
filterFunctions[i++] = new FunctionScoreQuery.FilterScoreFunction(filter, builder.queryName(), scoreFunction);
filterFunctions[i++] = new FunctionScoreQuery.FilterScoreFunction(filter, scoreFunction, builder.queryName());
}
}

Expand Down

0 comments on commit 3eecdc4

Please sign in to comment.