Commit af05eda
Fix NPE when metadata is null in MilvusVectorStore (spring-projects#4116)
Adds a null check before injecting the distance property into metadata to prevent a NullPointerException
if metadata is missing from the row record.
The change is intentionally minimal and does not alter existing behavior beyond avoiding the crash.
Some search results do not carry metadata (or the metadata value is null).
Calling JsonObject.addProperty(...) on a null reference throws an NPE and breaks the mapping pipeline.
Add a null guard around the distance injection step to ensure we do not call addProperty(...) on a null metadata.
Fixes spring-projects#4115
Auto-cherry-pick to 1.0.x
Signed-off-by: little_huang <[email protected]>
Signed-off-by: logan-mac <[email protected]>1 parent 86d4981 commit af05eda
File tree
1 file changed
+4
-2
lines changed- vector-stores/spring-ai-milvus-store/src/main/java/org/springframework/ai/vectorstore/milvus
1 file changed
+4
-2
lines changedLines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
382 | | - | |
383 | | - | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
384 | 386 | | |
385 | 387 | | |
386 | 388 | | |
| |||
0 commit comments