diff --git a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java index cc43acf..2af50cd 100644 --- a/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java +++ b/hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java @@ -92,7 +92,10 @@ public class WeaviateService { // log.info("vector:{}",JSON.toJSONString(vector.get(i))); Map properties = this.objectToMap(entities.get(i)); log.info("properties:{}",JSON.toJSONString(properties)); - creator.withProperties(properties).withVectors(vector.get(i)).run(); + Result run = creator.withProperties(properties).withVectors(vector.get(i)).run(); + if(run.hasErrors()) { + log.error("保存失败!,保存结果为:{}",JSON.toJSONString(run)); + } } } else { entities.forEach(entity -> creator.withProperties(this.objectToMap(entity)).run()); @@ -104,7 +107,13 @@ public class WeaviateService { private Map objectToMap(Object object) { JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(object)); Map properties = new HashMap<>(); - jsonObject.forEach((k,v) -> properties.put(k,v)); + jsonObject.forEach((k,v) -> { + if("id".equalsIgnoreCase(k)) { + properties.put("id_",v); + } else { + properties.put(k,v); + } + }); return properties; }