File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rank/textsimilarity Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 3030import java .util .List ;
3131import java .util .Objects ;
3232
33+ import static org .elasticsearch .xpack .inference .rank .textsimilarity .TextSimilarityRankRetrieverBuilder .FIELD_FIELD ;
34+ import static org .elasticsearch .xpack .inference .rank .textsimilarity .TextSimilarityRankRetrieverBuilder .INFERENCE_ID_FIELD ;
35+ import static org .elasticsearch .xpack .inference .rank .textsimilarity .TextSimilarityRankRetrieverBuilder .INFERENCE_TEXT_FIELD ;
36+ import static org .elasticsearch .xpack .inference .rank .textsimilarity .TextSimilarityRankRetrieverBuilder .MIN_SCORE_FIELD ;
37+
3338/**
3439 * A {@code RankBuilder} that enables ranking with text similarity model inference. Supports parameters for configuring the inference call.
3540 */
@@ -103,7 +108,14 @@ public void doWriteTo(StreamOutput out) throws IOException {
103108
104109 @ Override
105110 public void doXContent (XContentBuilder builder , Params params ) throws IOException {
106- throw new UnsupportedOperationException ("This should not be XContent serialized" );
111+ // this object is not parsed, but it sometimes needs to be output as xcontent
112+ // rankWindowSize serialization is handled by the parent class RankBuilder
113+ builder .field (INFERENCE_ID_FIELD .getPreferredName (), inferenceId );
114+ builder .field (INFERENCE_TEXT_FIELD .getPreferredName (), inferenceText );
115+ builder .field (FIELD_FIELD .getPreferredName (), field );
116+ if (minScore != null ) {
117+ builder .field (MIN_SCORE_FIELD .getPreferredName (), minScore );
118+ }
107119 }
108120
109121 @ Override
You can’t perform that action at this time.
0 commit comments