Skip to content

Commit 1139842

Browse files
Adding matchAllDocs support for vector fields
1 parent 60da6f4 commit 1139842

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/highlight/SemanticTextHighlighter.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import org.apache.lucene.search.IndexSearcher;
1616
import org.apache.lucene.search.KnnByteVectorQuery;
1717
import org.apache.lucene.search.KnnFloatVectorQuery;
18+
import org.apache.lucene.search.MatchAllDocsQuery;
1819
import org.apache.lucene.search.Query;
1920
import org.apache.lucene.search.QueryVisitor;
2021
import org.apache.lucene.search.ScoreMode;
@@ -267,6 +268,8 @@ public void visitLeaf(Query query) {
267268
queries.add(fieldType.createExactKnnQuery(VectorData.fromFloats(knnQuery.getTargetCopy()), null));
268269
} else if (query instanceof KnnByteVectorQuery knnQuery) {
269270
queries.add(fieldType.createExactKnnQuery(VectorData.fromBytes(knnQuery.getTargetCopy()), null));
271+
} else if (query instanceof MatchAllDocsQuery) {
272+
queries.add(new MatchAllDocsQuery());
270273
}
271274
}
272275
});
@@ -293,6 +296,13 @@ public QueryVisitor getSubVisitor(BooleanClause.Occur occur, Query parent) {
293296
}
294297
return this;
295298
}
299+
300+
@Override
301+
public void visitLeaf(Query query) {
302+
if (query instanceof MatchAllDocsQuery) {
303+
queries.add(new MatchAllDocsQuery());
304+
}
305+
}
296306
});
297307
return queries;
298308
}

0 commit comments

Comments
 (0)