V
V
Vlad2018-06-30 16:10:05
JavaScript
Vlad, 2018-06-30 16:10:05

What is the best way to solve the problem of searching in an array by given parameters?

Good afternoon,
There is a list of objects, for example:

[
    {
        "Id": "1234",
        "Name": "Vasya",
        "Address": "123 Somewhere I Belong"
    },
    {
        "Id": "54321",
        "Name": "Olga",
        "Address": "123 Gagarina street"
    },
]

I want to organize a search in this array in this way:
@name: Vasya, Vitya,Ola @address:hello,gagar,vodka
and as a result, get all the elements of the array that have at least one of the specified parameters.
An array can contain up to 3,000 elements (often less).
My stack: react, redux.
Question 1 : how to parse such a query? Regular season? I think there must be a module that already knows how to do this, but I can’t think of anything to google about.
Question 2 : how to search further?
The first option that came to mind is to try some client-based sql, like nano-sql, alasql.
But it's embarrassing that I store data in redux, and then sql is screwed up)
I ask for the help of experts in solving Question 1 and Question 2.
Thank you!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question