Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/populate_search_engine.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Populate Search Engine

on:
# schedule:
# - cron: "5 7 * * *" # every day at 07:05
schedule:
- cron: "5 7 * * *" # every day at 07:05
# to run this workflow manually from the Actions tab
workflow_dispatch:

Expand Down
12 changes: 3 additions & 9 deletions src/doc_builder/meilisearch_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,15 @@ def update_db_settings(client: Client, index_name: str):
return client, task_info


@wait_for_task_completion
def delete_embedding_db(client: Client, index_name: str):
index = client.index(index_name)
task_info = index.delete()
return client, task_info
index.delete()


@wait_for_task_completion
def clear_embedding_db(client: Client, index_name: str):
"""Delete all documents from an index without deleting the index itself."""
index = client.index(index_name)
task_info = index.delete_all_documents()
return client, task_info
index.delete_all_documents()


def get_all_document_ids(client: Client, index_name: str) -> set[str]:
Expand All @@ -199,12 +195,10 @@ def get_all_document_ids(client: Client, index_name: str) -> set[str]:
return all_ids


@wait_for_task_completion
def delete_documents_from_db(client: Client, index_name: str, doc_ids: list[str]):
"""Delete a batch of documents by ID from a Meilisearch index."""
index = client.index(index_name)
task_info = index.delete_documents(doc_ids)
return client, task_info
index.delete_documents(doc_ids)


def sanitize_for_id(text):
Expand Down