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

Case-insensitive filtering for arrays #6888

Open
NetOpWibby opened this issue Jun 25, 2020 · 1 comment
Open

Case-insensitive filtering for arrays #6888

NetOpWibby opened this issue Jun 25, 2020 · 1 comment

Comments

@NetOpWibby
Copy link

Is your feature request related to a problem? Please describe.
I am trying to run partial matches of a string with strings in an array. Currently, nothing I have tried works.

Describe the solution you'd like
I'd like an example on the offical site that shows how I might achieve this functionality.

Describe alternatives you've considered

// 1
r.expr([`(?i)${suppliedString}`]).contains(row("dataStuff"));
// 2
row("dataStuff").contains(`(?i)${suppliedString}`);
// 3
row("dataStuff").contains(`(?i)${suppliedString}`).default(false);
// 4
row("dataStuff").contains(`(?i)${suppliedString}`).default(true);

I've also tried this:

r.expr([suppliedString]).contains(row("dataStuff"));

It works only when suppliedString is the exact case and spelling.

Additional context
Case-insensitive filtering is easy to do with strings like in the example shown on this page:

// Will return william, William, WILLIAM, wiLLiam etc.
r.table("users").filter(function(user) {
    return user("name").match("(?i)^william$");
}).run(conn, function(err, result) {
    if (err) throw err;
    console.log(result);
});
@yaneony
Copy link

yaneony commented Jul 29, 2020

Can you please provide data structure you are using?

matches of a string with strings in an array

You will probably need to use .map function as well in that case.

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

No branches or pull requests

2 participants