Skip to content

Commit cd42117

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

File tree

1 file changed

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

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,16 @@ private Document toDocument(ScoredPoint point) {
297297
private Map<String, Value> toPayload(Document document) {
298298
try {
299299
var payload = QdrantValueFactory.toValueMap(document.getMetadata());
300-
payload.put(CONTENT_FIELD_NAME, io.qdrant.client.ValueFactory.value(document.getText()));
300+
301+
String documentContent = document.getText();
302+
if(!document.isText()) {
303+
throw new IllegalArgumentException("""
304+
QdrantVectorStore supports only text-based Document for now –
305+
received media-only Document; see issue #3609.
306+
""");
307+
}
308+
309+
payload.put(CONTENT_FIELD_NAME, io.qdrant.client.ValueFactory.value(documentContent));
301310
return payload;
302311
}
303312
catch (Exception e) {

0 commit comments

Comments
 (0)