replit / rippkgs

A CLI for indexing and searching packages in Nix expressions
MIT License
153 stars 2 forks source link

search: tweak results #18

Closed cdmistman closed 7 months ago

cdmistman commented 7 months ago

Why

results aren't 100% accurate, this is a small step to improving. if someone who's familiar with fuzzy matching wants to tweak the algorithm for even better results, then a contribution will be welcome, but i spent a little time trying to tweak with mixed results.

What changed

  1. if the crate is built with debug mode enabled, include the fuzzy score in the json output
  2. if there's an exact result, return i64::MAX as the fuzzy score

Test plan

run against some index, see the exact match being the top result (in my case, this was zsh)