Browse Source

fix: 向量数据库取值方式修改

zhongwei
haungxing 3 months ago
parent
commit
d3149796be
  1. 12
      hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java

12
hzims-service/hzims-big-model/src/main/java/com/hnac/hzims/bigmodel/database/service/WeaviateService.java

@ -209,16 +209,8 @@ public class WeaviateService {
private String getFieldValue(String fields,Object object) { private String getFieldValue(String fields,Object object) {
Class clazz = object.getClass(); JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(object));
return Func.toStrList(",", fields).stream().map(field -> { return Func.toStrList(",", fields).stream().map(field -> jsonObject.getString(field)).collect(Collectors.joining(" "));
try {
Field declaredField = clazz.getDeclaredField(field);
declaredField.setAccessible(true);
return declaredField.get(object).toString();
} catch (NoSuchFieldException | IllegalAccessException e) {
return null;
}
}).collect(Collectors.joining(" "));
} }
/** /**

Loading…
Cancel
Save