manticoresearch icon indicating copy to clipboard operation
manticoresearch copied to clipboard

Make non-php clients more high-level?

Open sanikolaev opened this issue 3 years ago • 2 comments

The task is to make a research on the feasibility of making Manticore's auto-generated clients more flexible, similar to what the php client is capable of - https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md#search and what Elasticsearch's NEST client does - https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/writing-queries.html

Related discussion in Reddit https://www.reddit.com/r/programming/comments/w8eexl/comment/ihs1ymd/?utm_source=share&utm_medium=web2x&context=3

sanikolaev avatar Jul 27 '22 15:07 sanikolaev

➤ Nick Sergeev commented:

A possible way it can be done:

  • create high-level query (hlq) api interface taking php client's api methods as a pattern https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/searchclass.md https://github.com/manticoresoftware/manticoresearch-php/blob/master/docs/indexclass.md

( Shall we use all the methods from there including highlight, facet, etc. ? )

  • create an auxillary Query class to be internally used by those hlq methods providing their work logic.

  • implement the hlq methods in corresponding templates for each of the clients (elixir !, java/c# ?)

  • implement the Query class in corresponding templates for each of the clients

  • in build.sh script, add a stage to the build workflow making a patch to the OpenApi's 'apiClient' template

  • the patch:

    1. embeds those previously generated templates of the hlq interface methods into 'apiClient'
    2. modifies 'ApIClient' adding a 'Query' class reference to it
    3. modifies the common ApIClient's 'callApi' function making it to use the 'query' object if user passes no explicit query in his original call of an api method

( Alternatively, just modify 'ApiClient' templates by hand. )

  • update yaml config
    1. add the 'Query' class schema to it
    2. make the 'query' parameter of the api methods it's used in optional

githubmanticore avatar Aug 02 '22 09:08 githubmanticore

@Nick-S-2018 Please take a look at https://github.com/Azure/autorest as an alternative to OpenAPI Generator. It has some interesting things, e.g. https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md#x-ms-paths

sanikolaev avatar Aug 03 '22 08:08 sanikolaev

➤ Nick Sergeev commented:

Here's a draft implementation for the Python client https://github.com/Nick-S-2018/python-client-draft/blob/main/docs/SearchApi.md

githubmanticore avatar Dec 14 '22 09:12 githubmanticore

➤ Sergey Nikolaev commented:

As discussed on today's call, please update the docs here https://github.com/Nick-S-2018/python-client-draft/blob/main/docs/SearchApi.md#example , so each separate functionality is exampled separately. Also, this looks wrong:

        sort=[ 
            , 
        ], 

githubmanticore avatar Mar 14 '23 09:03 githubmanticore

➤ Nick Sergeev commented:

Implemented in https://gitlab.com/manticoresearch/openapi/-/commit/b0a6713ce36bc6d32a4ec492af02c4daa52799e1, https://gitlab.com/manticoresearch/openapi/-/commit/fc8578cb569c85938e42359958f9a4aab886b1c0, https://gitlab.com/manticoresearch/openapi/-/commit/3a1de9025e62bf1d68b86479220c1d1f1d781c73

githubmanticore avatar Apr 20 '23 07:04 githubmanticore

Please look into the issues found by ChatGPT:

Python:

image image

Javascript: image

Java: image image image

.NET image

sanikolaev avatar May 06 '23 04:05 sanikolaev

➤ Nick Sergeev commented:

Done in https://gitlab.com/manticoresearch/openapi/-/commit/4190e23d65d12b84dc59a43478e2ba382cf44fdb, https://gitlab.com/manticoresearch/openapi/-/commit/0946ad1c0a39cc017b11502f2f32a92dcb68d2dd, https://gitlab.com/manticoresearch/openapi/-/commit/86d130357ee1e6f05113d43e57bb6880bedb4731, https://gitlab.com/manticoresearch/openapi/-/commit/498a6a5d946950186e5c807a443e2895430bf036, https://gitlab.com/manticoresearch/openapi/-/commit/ae05621a96dc7a14dd1483434614faea681927a9

githubmanticore avatar Jun 02 '23 07:06 githubmanticore