Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Delete index before starting scrapping #218

Merged
merged 1 commit into from
May 16, 2022
Merged
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: 4 additions & 0 deletions scraper/src/meilisearch_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,16 @@ class MeiliSearchHelper:
def __init__(self, host_url, api_key, index_uid, custom_settings):
self.meilisearch_client = meilisearch.Client(host_url, api_key)
self.meilisearch_index = self.meilisearch_client.index(index_uid)
self.delete_index()
self.add_settings(MeiliSearchHelper.SETTINGS, custom_settings)

def add_settings(self, default_settings, custom_settings):
settings = {**default_settings, **custom_settings}
self.meilisearch_index.update_settings(settings)

def delete_index(self):
self.meilisearch_index.delete()

def add_records(self, records, url, from_sitemap):
"""Add new records to the index"""

Expand Down