meilisearch-java icon indicating copy to clipboard operation
meilisearch-java copied to clipboard

Unable to use multisearch if jackson json handler is used

Open jdvalenzuelah opened this issue 6 months ago • 0 comments

Description When using JacksonJsonHandler with a default ObjectMapper, multisearch throws InvalidDefinitionException when serializing request. As a work around updating property visibility fixes it.

objectMapper.setVisibility(PropertyAccessor.FIELD, JsonAutoDetect.Visibility.ANY)

Expected behavior It should not be needed to change property visibility to make multisearch request

Current behavior Exception is thrown

Screenshots or Logs

java.lang.RuntimeException: Meilisearch Exception: {com.fasterxml.jackson.databind.exc.InvalidDefinitionException. Error=com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class com.meilisearch.sdk.MultiSearchRequest and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)}
	at com.meilisearch.sdk.http.request.BasicRequest.create(BasicRequest.java:22)
	at com.meilisearch.sdk.HttpClient.post(HttpClient.java:95)
	at com.meilisearch.sdk.Client.multiSearch(Client.java:433)

Environment (please complete the following information):

  • OS: macos
  • Meilisearch version: 1.9.0
  • meilisearch-java version: v.0.14.0

jdvalenzuelah avatar Aug 21 '24 14:08 jdvalenzuelah