Commit f0d4cbf
fix(qdrant): support Long type in payload by converting to String
Qdrant does not support java.lang.Long as a native payload type.
Previously, passing a Long value caused the following exception:
java.lang.IllegalArgumentException: Unsupported Qdrant value type: class java.lang.Long
at org.springframework.ai.vectorstore.qdrant.QdrantValueFactory.value(QdrantValueFactory.java:85)
at org.springframework.ai.vectorstore.qdrant.QdrantValueFactory.lambda$toValueMap$1(QdrantValueFactory.java:46)
...
To resolve this, Long values are now converted to their String representation
in QdrantValueFactory. This preserves precision and avoids serialization issues.
test(qdrant): add test to verify Long metadata values are stored as String
Adds a test to ensure that Long values in document metadata are
safely converted to String before being stored in Qdrant.
The test inserts a document with a Long-type "ref_id", performs
a similarity search, and verifies that:
- the result is not empty,
- the retrieved "ref_id" is a String,
- the value matches the original Long when parsed.
Also ensures cleanup by deleting the inserted document from the store.
Auto-cherry-pick to 1.0.x
Signed-off-by: Solomon Hsu <[email protected]>1 parent cecc046 commit f0d4cbf
File tree
2 files changed
+24
-0
lines changed- vector-stores/spring-ai-qdrant-store/src
- main/java/org/springframework/ai/vectorstore/qdrant
- test/java/org/springframework/ai/vectorstore/qdrant
2 files changed
+24
-0
lines changedLines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
317 | 338 | | |
318 | 339 | | |
319 | 340 | | |
| |||
0 commit comments