-
Notifications
You must be signed in to change notification settings - Fork 3.1k
pip search
returns results that only partially match the string
#3354
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
Comments
Pip is currently just doing a pypi search - search.py#L60
And then sorting by the score that pypi gives in its hits: search.py#L94-L101
We could do a simple sort by levenstein first perhaps, and then score, using something like pylev @dstufft @pfmoore @xavfernandez @qwcode any thoughts on drawbacks to changing the current sort? |
+1 on better search, but honestly I never use But if we can improve "pip search" - and maybe add to the output the PyPI URL - then I might use it more (modulo getting my @%^&$ access back, see discussion on the thread about NTLM :-)) |
Well |
Sorry to bump this aging thread, but has this been considered for future updates? Seems like a very simple to implement, yet extremely useful feature; just a simple option to do a strict match. It's irrelevant if the PyPI API is no longer maintained, all a user needs are the results filtered. One is often forced to pipe into grep to find what they want, but that of course doesn't help Windows users... |
You get the same useless result online, e.g.: https://pypi.python.org/pypi?%3Aaction=search&term=django-meta&submit=search |
@jedie It was actually searching for 'django-auth-ldap' that drove me here. Our queries probably return >90% the same packages... On closer inspection, there's probably somewhere in the region of 8000 - 9000 hits for your search, absolutely ridiculous. Edit: To be fair, 'django-meta' is sorted to the top on the web page, but this doesn't help when using a CLI. |
Closing this since pip is just using the PyPI search interface and thus it has no mechanism to really control it's searching mechanism. However if we implement something like #395 then we could work on something like this. |
STR:
(Using pip v7.1.2 with Python 2.7.10 under MSYS2.)
pip search "treeherder-client"
Expected:
One result, the same as when just the string "treeherder" is used instead, eg:
[~/src]$ pip search "treeherder" treeherder-client - Python library to retrieve and submit data to the Treeherder API
Actual:
These results contain the string "client" but not "treeherder".
It would appear
pip search
is splitting strings on hyphens and then finding any results that match any of the resultant substrings. This is:pip search -h
or https://pip.pypa.io/en/stable/reference/pip_search/PyPI's own search does return many results too, but at least that's sorted by weight:
https://pypi.python.org/pypi?%3Aaction=search&term=treeherder-client&submit=search
Perhaps the output from pip search could:
Many thanks :-)
The text was updated successfully, but these errors were encountered: