meilisearch-java: MeiliSearchApiException throw due to `Json deserialize error`

Filter doesn’t work for me same as other attributes that requires array. Code example:

val searchRequest = SearchRequest(query).also {
     it.matches = true
     it.attributesToRetrieve = null
     it.limit = limit
     it.offset = offset
     it.filter = arrayOf("title = media")
}
 index.search(searchRequest)

This returns:

MeiliSearchApiException{error=APIError{message=‘Was expecting an operation =, !=, >=, >, <=, <, TO or _geoRadius at [Ljava.lang.String;@8f8841a. 1:28 [Ljava.lang.String;@8f8841a’, code=‘invalid_filter’, type=‘invalid_request’, link=‘https://docs.meilisearch.com/errors#invalid_filter’}} at com.meilisearch.sdk.MeiliSearchHttpRequest.post(MeiliSearchHttpRequest.java:90) at com.meilisearch.sdk.Search.rawSearch(Search.java:93) at com.meilisearch.sdk.Search.search(Search.java:166) at com.meilisearch.sdk.Index.search(Index.java:284)

I checked in debug what library sends:

api = /indexes/global/search body = {“q”:“”,“offset”:0,“limit”:20,“cropLength”:200,“matches”:true,“filter”:“[Ljava.lang.String;@169dc22”}

It looks like there is issue with json serializer in your library, please fix.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 16 (6 by maintainers)

Most upvoted comments

I’m having almost exactly the same issue here. I’ve spoken to Amelie via the Meili Slack - we’re going to try upgrading the server to 0.26 and the library to 0.7.1 to see if that helps at all. Neither Kotlin or Java yields different results.

@brunoocasali to be honest that’s good news for me but, I’ve done it through the APIs as I can see that SDK will be delayed sometimes.

really appreciate your hard work here guys

Hi @mayangzz, Not yet, but the SDK is being rewritten I hope it will be available soon!

HI @TomBastable, Sorry for the delay and thanks for adding your problem here! I think @Andoctorey is right, it is probably due to the json serializer. Can you give more details about your environment? That I am able to reproduce the error? Thanks