Skip to content
Snippets Groups Projects
Commit 25a4c9c4 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Merge branch 'operon-struct-type' into operon-struct-type-article-update

parents 64dfc271 e70b3a91
No related branches found
No related tags found
No related merge requests found
Pipeline #128524 failed with stages
in 8 minutes and 34 seconds
...@@ -295,7 +295,7 @@ lint: ...@@ -295,7 +295,7 @@ lint:
df-wiki-cli meilisearch df-wiki-cli meilisearch
--host ${MEILI_HOST} --host ${MEILI_HOST}
--key "${MEILI_MASTER_KEY}" --key "${MEILI_MASTER_KEY}"
index-update refseqsanitized index index-update refseqsanitized sys_id
- > - >
df-wiki-cli df-wiki-cli
meilisearch meilisearch
......
...@@ -52,7 +52,8 @@ def main( ...@@ -52,7 +52,8 @@ def main(
def delete_all_documents(ctx: typer.Context, id: str): def delete_all_documents(ctx: typer.Context, id: str):
client = meilisearch.Client(ctx.obj.host, ctx.obj.key) client = meilisearch.Client(ctx.obj.host, ctx.obj.key)
index = client.index(id) index = client.index(id)
index.delete_all_documents() tasks = index.delete_all_documents()
console.print(tasks)
@app.command() @app.command()
......
...@@ -523,7 +523,7 @@ def split_on_comma(str_val: Optional[str]) -> Optional[List[str]]: ...@@ -523,7 +523,7 @@ def split_on_comma(str_val: Optional[str]) -> Optional[List[str]]:
return None return None
def update_refseq(client, document, file): def update_refseq(client, document, file, primary_key="sys_id"):
index = client.index(document.lower()) index = client.index(document.lower())
documents = [] documents = []
with open(file, "r") as csvfile: with open(file, "r") as csvfile:
...@@ -536,7 +536,7 @@ def update_refseq(client, document, file): ...@@ -536,7 +536,7 @@ def update_refseq(client, document, file):
row["accession_in_sys"] = split_on_comma(row["accession_in_sys"]) row["accession_in_sys"] = split_on_comma(row["accession_in_sys"])
doc = RefSeqCsv(**row) doc = RefSeqCsv(**row)
documents.append(doc.model_dump(by_alias=True)) documents.append(doc.model_dump(by_alias=True))
tasks = index.add_documents_in_batches(documents, primary_key="sys_id") tasks = index.add_documents_in_batches(documents, primary_key=primary_key)
for task in tasks: for task in tasks:
console.print(task) console.print(task)
index.update_pagination_settings({"maxTotalHits": 1000000}) index.update_pagination_settings({"maxTotalHits": 1000000})
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment