meilisearch / meilisearch/meilisearch-java

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

Open
#394 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
245
Forks
152
PR merge metrics
No merged PRs in 30d

Description

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

```json
{
"synonyms": null
}
```

As the json body of the `updateSettings` method.

Unfortunately, looking at this code:

https://github.com/meilisearch/meilisearch-java/blob/04244faad4b653fe4cdc5eff871463ce6e8b83bc/src/main/java/com/meilisearch/sdk/Settings.java#L33-L60

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](https://github.com/meilisearch/meilisearch-java/blob/04244faad4b653fe4cdc5eff871463ce6e8b83bc/src/main/java/com/meilisearch/sdk/Settings.java#L33-L60)

> 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/main/java/com/meilisearch/sdk/Settings.java around lines 33-60 and trace how updateSettings builds its JSON request. Determine whether explicitly supplied null settings can be distinguished from omitted settings, then verify that null resets a setting while omitted fields remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.