gum icon indicating copy to clipboard operation
gum copied to clipboard

[Feature Request] - Filter - Filter by whole words only option

Open Justinzobel opened this issue 2 years ago • 5 comments

For instance

echo "The quick brown fox" | gum filter

Will show up if I type hioo in the filter.

I'd prefer an option where it will only show up quick or k bro

Justinzobel avatar Jul 31 '22 04:07 Justinzobel

Are you saying that it searches the entire string for those characters instead of a singular word?

FiReLScar avatar Jul 31 '22 10:07 FiReLScar

Yeah it will highlight each letter.

image

Justinzobel avatar Jul 31 '22 13:07 Justinzobel

I just found this project but they use sahilm/fuzzy for the fuzzy searching so maybe the problem is with them. Again I just found this project so I could be wrong.

FiReLScar avatar Aug 01 '22 09:08 FiReLScar

Agreed this would be useful. In my testing with gum filter I have say:

> Filter...
• Clear
  /Users/mathomp4/Models/GrITAS-MERRA2_V2_SLES12-fromCVS/GrITAS
  /Users/mathomp4/Models/mat-qvi-1_0_r3-SLES12-fromCVS/QVI
  /Users/mathomp4/Models/GEOSgcm-GNU-TestMOM6AppUpdate/GEOSgcm
  /Users/mathomp4/Models/GEOSgcm-Intel-TestMOM6AppUpdate/GEOSgcm
  /Users/mathomp4/Models/GEOSldas-NAG-OLD/GEOSldas
  /Users/mathomp4/Models/GEOSldas-NAG/GEOSldas
  /Users/mathomp4/Models/GrITAS-MERRA2_V2_SLES12-fromCVS/GrITAS
  /Users/mathomp4/Models/mat-qvi-1_0_r3-SLES12-fromCVS/QVI
  /Users/mathomp4/Models/MAPL3-GNU/MAPL
  /Users/mathomp4/Models/MAPL-GNU12-ZstdBaselib/MAPL
  /Users/mathomp4/Models/MAPL-GNU/MAPL
  /Users/mathomp4/Models/MAPL-Intel/MAPL
  /Users/mathomp4/Models/MAPL-NAG-7.1_7113/MAPL
  /Users/mathomp4/Models/MAPL-mepopackage/MAPL

and I'd like to drill down to the MAPL ones. Unfortunately, when I try that I get pretty much everything still there since all it matches letters early on that don't "mean" as much:

Screen Shot 2022-08-09 at 4 16 02 PM

Note that filtering on mapl or MAPL doesn't help.

mathomp4 avatar Aug 09 '22 20:08 mathomp4

I just found this project but they use sahilm/fuzzy for the fuzzy searching so maybe the problem is with them. Again I just found this project so I could be wrong.

It looks like @isacikgoz has made some improvements on the original fuzzy. Maybe he'd know if whole-word searching is possible?

mathomp4 avatar Aug 29 '22 19:08 mathomp4

Since I like this project and it's part of the Hacktoberfest I was trying to have a look at this.

I have a working POC, can I assign this to me and open a PR?

enrichman avatar Oct 08 '22 21:10 enrichman

Hey @enrichman for sure you can open a PR!

maaslalani avatar Oct 08 '22 21:10 maaslalani

Thanks @maaslalani, I've found a couple of issues with my initial approach, but I've fixed them.

enrichman avatar Oct 08 '22 22:10 enrichman