manticoresearch
manticoresearch copied to clipboard
Make non-php clients more high-level?
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
➤ 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
Queryclass 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:
- embeds those previously generated templates of the hlq interface methods into 'apiClient'
- modifies 'ApIClient' adding a 'Query' class reference to it
- 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
- add the 'Query' class schema to it
- make the 'query' parameter of the api methods it's used in optional
@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
➤ 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
➤ 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=[
,
],
➤ 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
Please look into the issues found by ChatGPT:
Python:

Javascript:

Java:

.NET

➤ 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