-
Notifications
You must be signed in to change notification settings - Fork 64
Adds replace_all_rules and replace_all_synonyms #390
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -672,6 +672,17 @@ def batch_synonyms(self, synonyms, forward_to_slaves=False, | |
|
||
return self._req(False, '/synonyms/batch', 'POST', request_options, params, synonyms) | ||
|
||
def replace_all_synonyms(self, synonyms, request_options=None): | ||
""" | ||
Replace all synonyms in the index. | ||
@param synonyms the synonyms to upload as a list of python dictionary. | ||
""" | ||
params = { | ||
'replaceExistingSynonyms': True | ||
} | ||
|
||
return self._req(False, '/synonyms/batch', 'POST', request_options, params, data=synonyms) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you not use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @julienbourdeau Because all the extra works of setting the params of the |
||
|
||
def get_synonym(self, object_id, request_options=None): | ||
""" | ||
Get a synonym from this index. | ||
|
@@ -1057,6 +1068,17 @@ def save_rule(self, rule, forward_to_replicas=False, request_options=None): | |
params = {'forwardToReplicas': forward_to_replicas} | ||
return self._req(False, '/rules/%s' % str(rule['objectID']), 'PUT', request_options, params, rule) | ||
|
||
def replace_all_rules(self, rules, request_options=None): | ||
""" | ||
Replace all rules in the index. | ||
@param rules the rules to upload as a list of python dictionary. | ||
""" | ||
params = { | ||
'clearExistingRules': True | ||
} | ||
|
||
return self._req(False, '/rules/batch', 'POST', request_options, params, data=rules) | ||
|
||
def batch_rules(self, rules, forward_to_replicas=False, clear_existing_rules=False, request_options=None): | ||
""" | ||
Save a batch of new rules | ||
|
Uh oh!
There was an error while loading. Please reload this page.