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

Mas d31 i433re2capture #438

Closed
wants to merge 8 commits into from
Closed

Conversation

martinsumner
Copy link
Owner

@martinsumner martinsumner commented Apr 27, 2024

Allow for evaluation and filtering of 2i terms.

Eval: Have a language of functions whereby, a map of Key/Value pairs can be extracted by applying those functions in a pipeline.

Filter: Have a language of functions and operators to apply a logic expression to determine if a term matches a filter, based on the entries in the map output from the eval pipeline.

The aim is to have an alternative to regular expression filtering in Riak. Sometimes the auto-generation of regular expressions become complex, and somethings (such as date ranges) and potentially impossible. The aim of the filter expression is to do this in a more natural language.

Allow for a capturing regular expression to be passed with a filter function that will filter based on the captured output.

Also allows a specific captured term to be returned as the returned term (rather than the whole index term)
First draft of allowing an externally provided comparison expression to be validated, parsed and evaluated
Required as re2 can only output binary not string in captures.
Allow for capture with either delimited index terms, or with regex capture, and then filtering of captured attributes using a logical expression.

The xref check `locals_not_used` is now ignored due to issues with auto-generated module.
Allow for the generation of projected attributes from an index term
Allow for additional functions in eval.  Change the leveled query API to generalise application of eval/filter expressions.
Remove `capture` option - as all can be achieved via eval/filter.
@@ -112,10 +112,17 @@
{index_specs(), infinity|integer()}. % {KeyChanges, TTL}
-type maybe_lookup() ::
lookup|no_lookup.
-type actual_regex() ::
reference()|{re_pattern, term(), term(), term(), term()}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason not to use the opaque type re:mp() instead of re_patten...?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Term, Key, AttrMap) ->
TermToSplit = term_to_process(InKey, Term, Key, AttrMap),
CptTerms = string:split(TermToSplit, Delim, all),
L = min(length(CptTerms), length(ExpKeys)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in OTP 26 there is now a How parameter for zip. Using trim would reduce this code. But only introduced for OTP26.

@martinsumner
Copy link
Owner Author

Replaced with #440

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

Successfully merging this pull request may close these issues.

None yet

2 participants