meilisearch / meilisearch/meilisearch-java
encounter error when trying search with AttributesToHighlight
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 245
- Forks
- 152
- PR merge metrics
- No merged PRs in 30d
Description
I'm encounter json serialize error when trying search method to get documents via JAVA SDK,
here are the sample code.
here is the error stacktrace
Meilisearch ApiException: {Error=APIError: {message='Invalid value type at .attributesToHighlight: expected an array, but found a string: "**[Ljava.lang.String;@10fc5e2f**"', code='invalid_search_attributes_to_highlight', type='invalid_request', link='https://docs.meilisearch.com/errors#invalid_search_attributes_to_highlight'}}
pls refer the highlighted part, I noticed that org.json.JSONObject wrongly serialize the String arrary to [Ljava.lang.String;@10fc5e2f
any idea to reslove this issue? as workaround, I'm using JAVA API to do the search instead temporary.
Environment (please complete the following information):
- OS: windows 10
- Meilisearch version: v1.4.2
- meilisearch-java version: v0.11.5
- org.json version: 20231013, as sdk pom required
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the sample code shown in the issue and reproduce the JSON serialization error for the Java SDK search request using AttributesToHighlight. Trace how that value is serialized and compare it with the API's expected array format. Done means the request sends an array instead of the Java array object's string representation and the reported search succeeds.
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
- 38/100