Skip to content

Commit

Permalink
chore: modify wiki bulk para
Browse files Browse the repository at this point in the history
  • Loading branch information
cir9no committed Nov 4, 2024
1 parent 99320a3 commit 4a225ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions seasearch/index_store/wiki_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
logger = logging.getLogger(__name__)


SEASEARCH_WIKI_BULK_OPETATE_LIMIT = 25
SEASEARCH_WIKI_BULK_ADD_LIMIT = 10
SEASEARCH_WIKI_BULK_DELETE_LIMIT = 50
WIKI_PAGES_DIR = '/wiki-pages'
WIKI_CONFIG_PATH = '_Internal/Wiki'
WIKI_CONFIG_FILE_NAME = 'index.json'
Expand Down Expand Up @@ -168,7 +169,7 @@ def process_file(doc_uuid, content):
'content': content
}
bulk_add_params.extend([index_info, doc_info])
if len(bulk_add_params) >= SEASEARCH_WIKI_BULK_OPETATE_LIMIT:
if len(bulk_add_params) >= SEASEARCH_WIKI_BULK_ADD_LIMIT:
bulk_add()

for path, obj_id, mtime, size in files:
Expand Down Expand Up @@ -201,12 +202,12 @@ def bulk_delete():
continue
doc_uuid = path.split('/')[2]
delete_params.append({'delete': {'_id': doc_uuid, '_index': index_name}})
if len(delete_params) >= SEASEARCH_WIKI_BULK_OPETATE_LIMIT:
if len(delete_params) >= SEASEARCH_WIKI_BULK_DELETE_LIMIT:
bulk_delete()

for doc_uuid in doc_uuids:
delete_params.append({'delete': {'_id': doc_uuid, '_index': index_name}})
if len(delete_params) >= SEASEARCH_WIKI_BULK_OPETATE_LIMIT:
if len(delete_params) >= SEASEARCH_WIKI_BULK_DELETE_LIMIT:
bulk_delete()
bulk_delete()

Expand Down

0 comments on commit 4a225ae

Please sign in to comment.