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

有搜索功能吗?Is there a search function? #114

Open
ztg-zlu opened this issue Apr 21, 2021 · 6 comments
Open

有搜索功能吗?Is there a search function? #114

ztg-zlu opened this issue Apr 21, 2021 · 6 comments
Labels

Comments

@ztg-zlu
Copy link

ztg-zlu commented Apr 21, 2021

这个组件,有搜索功能吗??

@leezng leezng added the feature label Apr 23, 2021
@JowJoris
Copy link

This would be nice to have for large JSON objects.

@JoshuaRobertson
Copy link

Hi @leezng is this something you are planning to include? It would be handy for filtering large datasets like @JowJoris mentioned.

@leezng
Copy link
Owner

leezng commented Nov 21, 2023

I'm very sorry that this issue has not been dealt with. I expect to release a minimum usable method in the next version.

Here, I also hope to collect everyone’s opinions. My initial idea is to search for key and value, and use ref for external calls. If you have any ideas, please reply.

@JoshuaRobertson
Copy link

@leezng no need to apologise, it's a great package.

I have a few points to consider:

  • It would be useful if it could search nested arrays
  • A strict mode so it can be like or exact

@leezng
Copy link
Owner

leezng commented Nov 22, 2023

@leezng no need to apologise, it's a great package.

I have a few points to consider:

  • It would be useful if it could search nested arrays
  • A strict mode so it can be like or exact

@JoshuaRobertson strict mode is a good suggestion. Can you provide a specific example for the first point? I'm not sure what effect you want to achieve.

@JoshuaRobertson
Copy link

@leezng I think a strict mode for the search would help so you can filter by certain search terms. If we use this example array:

const users = [
  { name: 'John', age: 30, hobbies: ['reading', 'coding'] },
  { name: 'Alice', age: 25, hobbies: ['cooking', 'traveling'] },
  { name: 'Bob', age: 35, hobbies: ['gardening', 'gaming'] }
]

something like:

  • Strict: only return array items that exactly match, such as "coding" would return one result (John)
  • Like: return array items that include any of the search, such as "co" would return two results (John & Alice)

What do you think?

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

No branches or pull requests

4 participants