Fitin for infinity. (#4722)

### What problem does this PR solve?

### Type of change

- [x] Refactoring
This commit is contained in:
Kevin Hu
2025-02-05 16:47:05 +08:00
committed by GitHub
parent 307717b045
commit 283d036cba
2 changed files with 7 additions and 3 deletions

View File

@ -65,9 +65,12 @@ class KGSearch(Dealer):
def _ent_info_from_(self, es_res, sim_thr=0.3):
res = {}
es_res = self.dataStore.getFields(es_res, ["content_with_weight", "_score", "entity_kwd", "rank_flt",
"n_hop_with_weight"])
flds = ["content_with_weight", "_score", "entity_kwd", "rank_flt", "n_hop_with_weight"]
es_res = self.dataStore.getFields(es_res, flds)
for _, ent in es_res.items():
for f in flds:
if f in ent and ent[f] is None:
del ent[f]
if float(ent.get("_score", 0)) < sim_thr:
continue
if isinstance(ent["entity_kwd"], list):