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

Make it possible to reset some specific settings via the updateSettings route #394

Open
bidoubiwa opened this issue May 24, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@bidoubiwa
Copy link
Contributor

Description
For example, it is possible to reset the synonyms to it' default value by sending

{
   "synonyms": null
}

As the json body of the updateSettings method.

Unfortunately, looking at this code:

String getUpdateQuery() {
JSONObject jsonObject = new JSONObject();
if (this.getSynonyms() != null) {
jsonObject.put("synonyms", this.getSynonyms());
}
if (this.getStopWords() != null) {
jsonObject.put("stopWords", this.getStopWords());
}
if (this.getRankingRules() != null) {
jsonObject.put("rankingRules", this.getRankingRules());
}
if (this.getFilterableAttributes() != null) {
jsonObject.put("filterableAttributes", this.getFilterableAttributes());
}
if (this.getDistinctAttribute() != null) {
jsonObject.put("distinctAttribute", this.getDistinctAttribute());
}
if (this.getSearchableAttributes() != null) {
jsonObject.put("searchableAttributes", this.getSearchableAttributes());
}
if (this.getDisplayedAttributes() != null) {
jsonObject.put("displayedAttributes", this.getDisplayedAttributes());
}
if (this.getSortableAttributes() != null) {
jsonObject.put("sortableAttributes", this.getSortableAttributes());
}
return jsonObject.toString();
}

It appears that if the user sets synonyms to null it will not be added to the final body send to updateSettings, and thus, it will not reset the synonyms.

As per the documentation

Passing null to an index setting will reset it to its default value.

It may not be possible to do it as we cannot know the difference between a field not present or a field set specifically to null. Nonetheless if it is possible, it should be investigated.

@bidoubiwa bidoubiwa added the enhancement New feature or request label May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant