jeancroy / fuzz-aldrin-plus

Sublime text like fuzzy filtering - compatible with atom/fuzzaldrin
MIT License
269 stars 21 forks source link

No results for query with only optional characters #13

Closed sadovnychyi closed 8 years ago

sadovnychyi commented 8 years ago
fuzz  = require("fuzzaldrin-plus");
fuzz.filter(["bla", "_test", "test"], "_");

I expected to see "_test" in results, but got nothing instead. It works in fuzzaldrin. Anything I'm missing about how to configure optional characters?

sadovnychyi/autocomplete-python#130

jeancroy commented 8 years ago
fuzz  = require("fuzzaldrin-plus");
fuzz.filter(["bla", "_test", "test"], "_t");

This will return the two last result (thus _ can be there or no), better score if it is. There is a spec that say if no input return no result with a short circuit.

Would you want that a string made only of optional characters return all results ?

sadovnychyi commented 8 years ago

I would like to return all results with that optional character/s presented. In this case only "_test".

sadovnychyi commented 8 years ago

Or, at least there's should be a way to change regex for optional characters. Can I monkey patch it from outside somehow? Since in python "_" is pretty important part of names.

jeancroy commented 8 years ago

Optional character regex is applied once at the construction of query so I can definitively make it part of the option hash

jeancroy commented 8 years ago

Version 0.3.1 now have the behavior you want. Other candidates are not explicitly filtered out, but since nothing match, they still have score of 0.

Version 0.4 will have the ability to set optional character regex. I'll also add a flag that set whether the filtering should be done assuming result are path. (Right now it's always making that assumption and surprisingly it works)

sadovnychyi commented 8 years ago

Thanks, it's fixed issue for me!