Skip to content

Commit

Permalink
let index be batchly. (infiniflow#733)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?

let index be batchly.

### Type of change


- [x] Refactoring
  • Loading branch information
KevinHuSh authored May 11, 2024
1 parent f7897e9 commit 57b7c20
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rag/svr/task_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,12 @@ def main():
init_kb(r)
chunk_count = len(set([c["_id"] for c in cks]))
st = timer()
es_r = ELASTICSEARCH.bulk(cks, search.index_name(r["tenant_id"]))
es_r = ""
for b in range(0, len(cks), 32):
es_r = ELASTICSEARCH.bulk(cks[b:b+32], search.index_name(r["tenant_id"]))
if b % 128 == 0:
callback(prog=0.8 + 0.1 * (b + 1) / len(cks), msg="")

cron_logger.info("Indexing elapsed({}): {}".format(r["name"], timer()-st))
if es_r:
callback(-1, "Index failure!")
Expand Down

0 comments on commit 57b7c20

Please sign in to comment.