lib-rql icon indicating copy to clipboard operation
lib-rql copied to clipboard

Support Comparisons with RegEx

Open hugobessa opened this issue 2 years ago • 7 comments

Are there plans to support Comparisons with RegEx? Are PRs introducing this feature welcome?

hugobessa avatar Mar 09 '22 15:03 hugobessa

Hi, @hugobessa ! Sorry for a delayed response, we've missed somehow.

Anyway, there were no plans to support RegEx. For me it's hard to imagine cases, when RegEx search is an optimal solution for an API filter, do you have some? Also, I may be mistaken, but I think that various DB engines have different RegEx flavours, so it seems a hard task to solve generically.

Team @zzzevaka, @marcserrat, @ffaraoneim, what do you think?

maxipavlovic avatar Mar 28 '22 18:03 maxipavlovic

@maxipavlovic you are right, regex syntax is DB dependent, it would be strange that an API consumer would know the DB engine behind the API. But for lib-rql perhaps it makes sense. What do you think?

ghost avatar Mar 29 '22 07:03 ghost

I see your point @ffaraoneim. I like the idea of support for filtering by Python regex in Python part.

maxipavlovic avatar Mar 31 '22 20:03 maxipavlovic

In theory, the __regex lookup on Django converts from Python regex to a format that the database understands. That's what the documentation says, at least

hugobessa avatar Apr 01 '22 15:04 hugobessa

What I mean is that it would make sense for lib-rql but also for django-rql

hugobessa avatar Apr 01 '22 15:04 hugobessa

Frankly speaking, personally I wouldn't want to expand this further than python version only, as we are also thinking of adding parsing to https://github.com/cloudblue/javascript-rql and regular expressions seem to be different in Python / JS, at least according to this and somehow they could affect grammar.

IMHO, LIKE functionality seems to cover most of the cases in Django-RQL.

maxipavlovic avatar Apr 07 '22 16:04 maxipavlovic

@hugobessa CLA is now ready and automated :)

maxipavlovic avatar Apr 25 '22 09:04 maxipavlovic