Skip to content

Commit f5c6b64

Browse files
authored
Fixes bug with custom settings (#28)
* Fixes bug with custom settings * remove unecessary duplicate
1 parent 1fd65c8 commit f5c6b64

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

scraper/src/config/config_loader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ConfigLoader:
2626
allowed_domains = None
2727
api_key = None
2828
app_id = None
29-
custom_settings = None
29+
custom_settings = {}
3030
extra_records = []
3131
index_uid = None
3232
index_uid_tmp = None

scraper/src/meilisearch_helper.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ class MeiliSearchHelper:
103103

104104
def __init__(self, host_url, api_key, index_uid, custom_settings):
105105
self.meilisearch_client = meilisearch.Client(host_url, api_key)
106-
self.__delete_and_create_index(index_uid)
107106
self.meilisearch_index = self.__delete_and_create_index(index_uid)
108-
settings = {**MeiliSearchHelper.SETTINGS, **custom_settings}
107+
self.add_settings(MeiliSearchHelper.SETTINGS, custom_settings)
108+
109+
def add_settings(self, default_settings, custom_settings):
110+
settings = {**default_settings, **custom_settings}
109111
self.meilisearch_index.update_settings(settings)
110112

111113
def add_records(self, records, url, from_sitemap):

scraper/src/tests/config_loader/abstract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def config(additional_config={}):
77
'allowed_domains': 'allowed_domains',
88
'api_key': 'api_key',
99
'app_id': 'app_id',
10-
'custom_settings': {},
10+
'custom_settings': None,
1111
'hash_strategy': 'hash_strategy',
1212
'index_uid': 'index_uid',
1313
'selectors': [],

0 commit comments

Comments
 (0)