Skip to content
Advertisement

How to restrict PyPi project search by adding search terms?

When I enter multiple words into PyPi project search, I would expect to get results matching all of the search terms, like in Google Search. But instead, it seems to return results matching any of the search terms.

For example, a search for lemmatize gives 230 results; a search for german gives 1526 results; but when I enter both lemmatize and german, I get 1709 results — which is apparently the union of the two result sets. I have tried lemmatize german, lemmatize AND german, lemmatize & german etc., but nothing seems to work.

So my question is: How to restrict my search on PyPi to get the intersection of results instead of union?

Advertisement

Answer

Quote the values: "german" "lemmatize" returns an intersection of 35 results.

This appears to be undocumented, and I’ve only discovered it by perusing the elasticsearch source code in warehouse, specifically the special handling of quoted vs unquoted strings.

Related: Support searching for an exact phrase #2850

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement