Skip to content

Commit 7ebbd32

Browse files
san.kimsan.kim
authored andcommitted
GH-3609: Fail fast on media-only Document in QdrantVectorStore
* Throw IllegalArgumentException when Document.isText() is false Signed-off-by: san.kim <[email protected]>
1 parent 089c3eb commit 7ebbd32

File tree

1 file changed

+7
-0
lines changed
  • vector-stores/spring-ai-qdrant-store/src/main/java/org/springframework/ai/vectorstore/qdrant

1 file changed

+7
-0
lines changed

vector-stores/spring-ai-qdrant-store/src/main/java/org/springframework/ai/vectorstore/qdrant/QdrantVectorStore.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,13 @@ private Document toDocument(ScoredPoint point) {
296296
*/
297297
private Map<String, Value> toPayload(Document document) {
298298
try {
299+
if(!document.isText()) {
300+
throw new IllegalArgumentException("""
301+
QdrantVectorStore supports only text-based Document for now –
302+
received media-only Document; see issue #3609.
303+
""");
304+
}
305+
299306
var payload = QdrantValueFactory.toValueMap(document.getMetadata());
300307
payload.put(CONTENT_FIELD_NAME, io.qdrant.client.ValueFactory.value(document.getText()));
301308
return payload;

0 commit comments

Comments
 (0)