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

Fuzzy search commands #42

Open
Hyde46 opened this issue Sep 19, 2021 · 6 comments
Open

Fuzzy search commands #42

Hyde46 opened this issue Sep 19, 2021 · 6 comments
Labels
✨ enhancement New feature or request
Milestone

Comments

@Hyde46
Copy link
Owner

Hyde46 commented Sep 19, 2021

No description provided.

@Hyde46 Hyde46 added the ✨ enhancement New feature or request label Sep 19, 2021
@PurpleMyst
Copy link

I'm willing to work on this as well.

@PurpleMyst
Copy link

Could I get some more specification? Do you want me to use fuzzy matching anytime we're matching on a name, or to implement the search subcommand in a particular way?

@Hyde46
Copy link
Owner Author

Hyde46 commented Oct 18, 2021

Excited that you're interested!

This might be a bit more involved, since the current search is quite simple and not smart in any capacity.
When running hoard list and typing any charactacter, apply_search is called.
The search matches any string which is contained in any struct field of all HoardCommand of the currently selected namespace.

The main goal would be to get fuzzy matching of these struct fields. The search subcommand you are referencing is a leftover to remove since I don't see any real use for it given the GUI exists.

I think there are several ways to approach this. One of them being as follows.
Implement fuzzy_search method for the CommandTrove ( Which is just a container for all HoardCommands ). So, something like

pub fn fuzzy_search(query_string: &str, namespace_filter: Option<String>) -> SearchResult

Where SearchResults contains the matching command ( And optimaly a way of indicating which characters matched to later color them appropriately in the GUI, though this could be implemented as a separate PR )

Plugging this functionality into the code would happen here and here
For example like this:

&trove.fuzzy_search( &app.input, Some(selected_tab) )

( Or None for the namespace_filter if the selected tab is "All" )

I'm open for any changes, or totally different approaches!
Do you have input on this?

@PurpleMyst
Copy link

I think this looks good, but I've a question: should fuzzy matching be the only option or should "exact" matching be kept as an option?

@Hyde46
Copy link
Owner Author

Hyde46 commented Oct 19, 2021

Good call with keeping exact matching an Option.
Maybe either a toggle able or with some kind of marker in the query string indicating that part of the string or the whole query has to match exactly

@Hyde46
Copy link
Owner Author

Hyde46 commented Nov 15, 2021

@PurpleMyst still considering working on this item?

@Hyde46 Hyde46 added this to the hoard 1.1.0 milestone Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants