|
7 | 7 |
|
8 | 8 | from algoliasearch import algoliasearch
|
9 | 9 |
|
10 |
| - |
11 | 10 | logger = logging.getLogger(__name__)
|
12 | 11 |
|
13 | 12 |
|
@@ -69,7 +68,8 @@ def __init__(self, model, client):
|
69 | 68 |
|
70 | 69 | # Check custom_objectID
|
71 | 70 | if self.custom_objectID:
|
72 |
| - if not (hasattr(model, self.custom_objectID) or (self.custom_objectID in all_fields)): |
| 71 | + if not (hasattr(model, self.custom_objectID) or |
| 72 | + (self.custom_objectID in all_fields)): |
73 | 73 | raise AlgoliaIndex('{} is not an attribute of {}.'.format(
|
74 | 74 | self.custom_objectID, model))
|
75 | 75 |
|
@@ -164,13 +164,16 @@ def reindex_all(self, batch_size=1000):
|
164 | 164 | batch.append(self.__build_object(instance))
|
165 | 165 | if len(batch) >= batch_size:
|
166 | 166 | result = self.__tmp_index.save_objects(batch)
|
167 |
| - logger.info('SAVE %d OBJECTS TO %s_tmp', len(batch), self.index_name) |
| 167 | + logger.info('SAVE %d OBJECTS TO %s_tmp', len(batch), |
| 168 | + self.index_name) |
168 | 169 | batch = []
|
169 | 170 | counts += 1
|
170 | 171 | if len(batch) > 0:
|
171 | 172 | result = self.__tmp_index.save_objects(batch)
|
172 |
| - logger.info('SAVE %d OBJECTS TO %s_tmp', len(batch), self.index_name) |
| 173 | + logger.info('SAVE %d OBJECTS TO %s_tmp', len(batch), |
| 174 | + self.index_name) |
173 | 175 | if result:
|
174 | 176 | self.__client.move_index(self.index_name + '_tmp', self.index_name)
|
175 |
| - logger.info('MOVE INDEX %s_tmp TO %s', self.index_name, self.index_name) |
| 177 | + logger.info('MOVE INDEX %s_tmp TO %s', self.index_name, |
| 178 | + self.index_name) |
176 | 179 | return counts
|
0 commit comments