Skip to content

Commit 43d4daa

Browse files
committed
changed error and the wrong comment
1 parent e86c6e0 commit 43d4daa

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

x-pack/plugin/search-business-rules/src/main/java/org/elasticsearch/xpack/searchbusinessrules/retriever/PinnedRetrieverBuilder.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ public int rankWindowSize() {
157157

158158
/**
159159
* Creates a PinnedQueryBuilder with the appropriate pinned documents.
160-
* Prioritizes docs over ids if both are present.
161160
*
162161
* @param baseQuery the base query to pin documents to
163162
* @return a PinnedQueryBuilder
@@ -177,7 +176,7 @@ protected SearchSourceBuilder finalizeSourceBuilder(SearchSourceBuilder source)
177176
validateSort(source);
178177
QueryBuilder underlyingQuery = source.query();
179178
if (underlyingQuery == null) {
180-
throw new IllegalArgumentException("[underlying query] must not be null for pinned retriever");
179+
throw new IllegalArgumentException("pinned retriever requires retriever with associated query");
181180
}
182181
source.query(createPinnedQuery(underlyingQuery));
183182
return source;
@@ -216,7 +215,7 @@ protected RankDoc[] combineInnerRetrieverResults(List<ScoreDoc[]> rankResults, b
216215
boolean isPinned = scoreDoc.score > PinnedQueryBuilder.MAX_ORGANIC_SCORE;
217216
if (isPinned) {
218217
String pinnedBy = (this.ids != null && this.ids.isEmpty() == false) ? "ids" : "docs";
219-
rankDocs[i] = new PinnedRankDoc(scoreDoc.doc, scoreDoc.score, scoreDoc.shardIndex, true);
218+
rankDocs[i] = new PinnedRankDoc(scoreDoc.doc, scoreDoc.score, scoreDoc.shardIndex, true, pinnedBy);
220219
} else {
221220
rankDocs[i] = new RankDoc(scoreDoc.doc, scoreDoc.score, scoreDoc.shardIndex);
222221
}

0 commit comments

Comments
 (0)