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

Score contiguous matches higher #18

Closed
eapache opened this issue Feb 22, 2016 · 3 comments
Closed

Score contiguous matches higher #18

eapache opened this issue Feb 22, 2016 · 3 comments

Comments

@eapache
Copy link
Contributor

eapache commented Feb 22, 2016

Here's an interesting case I came across where cpsm's scoring algorithm doesn't really do the right thing, but I think it should be easy enough to fix:

I have g:cpsm_query_inverting_delimiter = ' '. There is a file foo/bar/graph/order.rb. When I search cpsm with order gra that file is not the first match; the first match is tmp/VZOCh7GJ4RUldAJOTIMRwSm0k8DmFMRexROl... because if you'll note all of the necessary characters do appear in the correct order in that random string. The simple fix is to remove the tmp directory from the ctrl-p search path but I think it also reveals that cpsm should be prioritizing matches somewhat based on contiguity of the match. The desired file matched the given query in two large chunks, whereas the tmp file matched 8 individual characters.

The scorer already contains parts which is the number of path components... generalizing this to the number of contiguous match groups regardless of path componentization seems like a simple fix.

@nixprime
Copy link
Owner

A query-inverting delimiter doesn't imply a path separator, so your query is being interpreted as graorder; order gr/ should give you much better results.

@eapache
Copy link
Contributor Author

eapache commented Feb 23, 2016

Yes, I figured that out but I think my original point still stands. graorder matched in two contiguous chunks should score better than another match across eight discontinuous letters.

@eapache
Copy link
Contributor Author

eapache commented Mar 21, 2016

Experimental branch has been working very well for me. I don't know what else you plan to do before merging it to master, but I'm gonna close this regardless.

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

No branches or pull requests

2 participants