Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST plugin extensible to add new $select operators #76

Open
norbertbede opened this issue Jul 23, 2021 · 2 comments
Open

REST plugin extensible to add new $select operators #76

norbertbede opened this issue Jul 23, 2021 · 2 comments

Comments

@norbertbede
Copy link

https://mattermost.idempiere.org/idempiere/pl/xyten9e763nqmdnku1x7o6j1na

norbertbede
Looking for alternative content search by rest API (unnacented, fuzzy/similarto)

CarlosRuiz:
actually in ODataUtils there are 5 method operators coded: contains, startwith, endswith, tolower and toupper
you can use those operators in a $select query

Improvement
it would be good if we can find a way to add more operators via plugin for example add the operator unaccent in this case

the reason I suggest to do it in plugin (instead of directly in the core) is because the unaccent is not standard (f.e. oracle vs postgres) and there can be several implementations

something like adding an interface to add operators in other plugins like

define the operator:
unaccent

define the DB method:
unaccent(column)

define the parameter method:
unaccent(parameter)
@norbertbede
Copy link
Author

hello @CarlosRuiz-globalqss, @d-ruiz

We would like to implement this concept - this is something absolutely missing/dealbreaker.

I would like to ask you in help with implementation design advice.
Is it enough to write some comments in developer language which methods/classes, should be extended.

Best Regards.
norbert

@CarlosRuiz-globalqss
Copy link
Collaborator

Hi @norbertbede - if is a function that is supported by odata I would recommend to integrate it in the rest-core.

I see in odata for example these functions that we don't have implemented:
substringof
indexof
replace
substring
trim
concat
round
floor
ceiling

If not in that list - then is better to discuss what is the function required.

The problem with unaccent (which I think is what you're needing) is that there is a different implementation for that in postgresql (requiring an extension), another for oracle, and another for java, and it can be messy when combining two of those.

So, to allow adding new functions via plugin, I suppose that adding one of the functions above can give an overview about the work required - maybe is simply implementing some OSGi service or interface to add things to the arrays SUPPORTED_PARAM_METHODS and SUPPORTED_METHODS and find a way to get the corresponding conversion to SQL.

Regards,

Carlos Ruiz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants