Skip to content

Commit

Permalink
addressing PR comments - adding validation for text_similarity_rerank…
Browse files Browse the repository at this point in the history
…er retriever
  • Loading branch information
pmpailis committed Oct 7, 2024
1 parent d82cfcc commit a740af1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static TransportVersion def(int id) {
public static final TransportVersion INGEST_GEO_DATABASE_PROVIDERS = def(8_760_00_0);
public static final TransportVersion DATE_TIME_DOC_VALUES_LOCALES = def(8_761_00_0);
public static final TransportVersion TEXT_SIMILARITY_RERANKER_QUERY_REWRITE = def(8_762_00_0);

/*
* STOP! READ THIS FIRST! No, really,
* ____ _____ ___ ____ _ ____ _____ _ ____ _____ _ _ ___ ____ _____ ___ ____ ____ _____ _
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ public TextSimilarityRankRetrieverBuilder(
List<QueryBuilder> preFilterQueryBuilders
) {
super(retrieverSource, rankWindowSize);
if (retrieverSource.size() != 1) {
throw new IllegalArgumentException("[" + getName() + "] retriever should have exactly one inner retriever");
}
this.inferenceId = inferenceId;
this.inferenceText = inferenceText;
this.field = field;
Expand All @@ -127,7 +130,6 @@ public TextSimilarityRankRetrieverBuilder(

@Override
protected TextSimilarityRankRetrieverBuilder clone(List<RetrieverSource> newChildRetrievers) {
assert newChildRetrievers.size() == 1;
return new TextSimilarityRankRetrieverBuilder(
newChildRetrievers,
inferenceId,
Expand Down

0 comments on commit a740af1

Please sign in to comment.