Manticore Client (manticoresearch-java)

Hi,

I am not sure if this is the right category but here it goes, I created a pull request for manticoresearch-java project. Basically it looks like it cannot parse a response containing ‘warning’ field. It was in September so I was wondering if there are any plans to check it out anytime soon?

Thanks.

Hi. So you mean Add field warning to SearchResponse by vsmid · Pull Request #4 · manticoresoftware/manticoresearch-java · GitHub

The problem is that the java client and most other modern clients (except for php and go) are generated automatically through OpenAPI generator, so it’s not that straightforward to just accept the pull request and apply your change. Instead, we need to think how to make sure the change gets applied through OpenAPI generator. What we probably need to do is make the OpenAPI generation part of the clients public. Would you be willing to look into it then to try to apply your change the way it’s not lost when we regenerate the client?

Hi Sergey,

thanks for the reply. Yes, that’s the correct PR. If you would expose the client generation part I would be willing to take a look at it but I make no promises :slight_smile:

OK, it’s planned for the next week.

Hi @vsmid

We’ve published the openapi clients generator GitHub - manticoresoftware/openapi: Manticore Search clients generator

Please give it a try and make a PR to it, not to GitHub - manticoresoftware/manticoresearch-java: Official Java client for Manticore Search

Hi @Sergey,

so I’ve tried it locally before even adding warning field definition to the manticore.yml file and it appears that generating Java client produces broken equals/hashCode methods across Java classes.

I have run the generator with : ./build.sh java v5.0.0 command.

Example:
@Override
public int hashCode() {
return Objects.hash(tooktimedOutaggregationshitsprofile); // concatenated variables?
}

I have read in your docs that you have used v5.0.0 generator so before I start analyzing further could you maybe tell me if you stumbled on something like this?

Also, I have noticed some minor errors I would say, like:

  • manticore.json is not synced with manticore.yml
    e.g. missing aggregations so remove this file maybe?

  • build.sh will not run on macOs
    e.g. rm out/manticoresearch-java -rf fails due to the order of option/flags

Other than that, igoring the issue with equals/hashCode when I added warning field definition to manticore.yml the generated code looked ok. Are you ok with warning field definition to be given as

    warning:
      type: object
      additionalProperties: true

or would you prefer a dedicated object with schema?

Thank you for giving it a try. My colleague working on this project will look into the issues on Monday and will decide on the warning.

Hi @vsmid
thank you for your notices!

generating Java client produces broken equals/hashCode methods across Java classes.

Yes, we’ve found the bug in mustache templates and fixed it. Try the updated version.

manticore.json is not synced with manticore.yml

We’ve removed it as unnecessary.

We haven’t decided on the warning object schema yet, so yes, you can leave it as it is now.

Hi @Nick,

Thanks. I did try it and the code was generated. However, my code which was previously working is now failing.
It fails on UtilsApi.sql call saying that the query is missing.

Hi, @vsmid
can you please send us the diff between your previous working version and the current one?

Hi,
my working version is GitHub - manticoresoftware/manticoresearch-java: Official Java client for Manticore Search + my pull request available there. PR is just about adding warning field to SearchResponse.

At first glance, it’s unclear why the generation with the warning field added leads to such fail. Unfortunately, it’ll take some time before we start looking into this issue, so, if you want, you can try investigating it on your own - it may be quicker.

I do not think it is connected at all. When i find some time i will fix it and create a PR.

Hi guys,

I have been digging a little bit and it seems that commit 075487519511d22d01e5811e76c31c5b1919e4d9 introduced the problem (switch to jersey2). ApiClient#serialize method else part of the statement wraps string within double quotes which breaks sql query definition. I guess this is the reason why query=… can’t be deconstructed to name and value which in turn results in error message → query missing. Exact lines are 678 and 684.

Hi @vsmid
Thank you for investigating this! We’ve updated templates for jersey2. You can try it now.

Looks ok now. PR created.
When could we expect a new version in Maven central repo?

Thanks.

Hi,

I may have found another issue with SuccessResponse. I will let you know what it is when I take a better look at it.

Here is the description of the problem I mentioned in the post above. I am using InsertDocumentRequest and the exception thrown is:

com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "status" (class com.manticoresearch.client.model.SuccessResponse), not marked as ignorable (5 known properties: "created", "_id", "_index", "result", "found"])
 at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 80] (through reference chain: com.manticoresearch.client.model.SuccessResponse["status"])

The reason why this is happening now is that the older version contained @JsonIgnoreProperties(ignoreUnknown = true) which prevented the above exception from being thrown.

Hi @vsmid ,
thank you again for your investigation. We’ve updated templates to fix this issue too.

Hi @vsmid

We are waiting for you to make a final test to confirm the updated version + your change works for you before we can:

  • approve and merge your PR
  • test it ourselves
  • rebuild the java client
  • deploy it