소스 검색

Fix: tag_feas deletion error. (#6257)

### What problem does this PR solve?

#6218

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
tags/v0.18.0
Kevin Hu 7 달 전
부모
커밋
dd81c30976
No account linked to committer's email address
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8
    1
      rag/utils/es_conn.py

+ 8
- 1
rag/utils/es_conn.py 파일 보기

@@ -322,12 +322,19 @@ class ESConnection(DocStoreConnection):
# update specific single document
chunkId = condition["id"]
for i in range(ATTEMPT_TIME):
for k in doc.keys():
if "feas" != k.split("_")[-1]:
continue
try:
self.es.update(index=indexName, id=chunkId, script=f"ctx._source.remove(\"{k}\");")
except Exception:
logger.exception(f"ESConnection.update(index={indexName}, id={chunkId}, doc={json.dumps(condition, ensure_ascii=False)}) got exception")
try:
self.es.update(index=indexName, id=chunkId, doc=doc)
return True
except Exception as e:
logger.exception(
f"ESConnection.update(index={indexName}, id={id}, doc={json.dumps(condition, ensure_ascii=False)}) got exception")
f"ESConnection.update(index={indexName}, id={chunkId}, doc={json.dumps(condition, ensure_ascii=False)}) got exception")
if re.search(r"(timeout|connection)", str(e).lower()):
continue
break

Loading…
취소
저장