Skip to content

Be able to search within a keyword or category #491

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

Closed
carols10cents opened this issue Dec 8, 2016 · 7 comments · Fixed by #4382
Closed

Be able to search within a keyword or category #491

carols10cents opened this issue Dec 8, 2016 · 7 comments · Fixed by #4382
Labels
A-frontend 🐹 A-search C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works E-help-wanted

Comments

@carols10cents
Copy link
Member

Great idea from @wesleywiser on #488:

It seems like the libraries::ffi::C category will have 80% of the crates and the other categories will be extremely sparse by comparison. It also seems to me that if I want to use an external library, I already know the name of that library so what I really want is a way to search by library name and filter to just FFI crates.

I guess it just seems strange to me to have a separate category for such a small number of crates. libraries::data-structures, for example, might have hundreds or even thousands of crates in it. Breaking up the "language ffi crates" into sub categories seems like a case of "premature categorization" if you will.

Sorry to keep bringing up search filters for categories, but if you could limit search results by category, then searching for "ruby" within libraries::ffi seems like it would be sufficient.

@carols10cents
Copy link
Member Author

Changed my mind about this being easy. The problem is that each query parameter to the crate index API route is currently mutually exclusive, so this code would need to be rearranged to allow for building up the SQL to possibly include BOTH the full text search AND the category or keyword conditions.

Then we'll need to decide whether to add a different search box that's closer to the category/keyword heading, or just change the behavior and appearance of the search box at the top to make it clear that using it on a keyword or category page will search within that keyword or category and not the whole page.

This could be done in pieces-- just getting the API accepting multiple parameters and using all of them could be one PR, and the UI stuff could be another.

@carols10cents
Copy link
Member Author

The backend part is done - see #666! Now to figure out the frontend...

@neunenak
Copy link

I'll take a crack at this.

@GregWoods
Copy link

Searching for no-std crates is vital for embedded (and others). Is there any progress on this?

@carols10cents
Copy link
Member Author

Any progress on this would appear on this issue, so no.

@follower
Copy link

FWIW, I started looking into this and discovered that the work in #666 does appear to have also been deployed on the server, so if you want, it seems it's possible to at least craft the queries by hand & view the returned JSON with browser dev tools...

e.g. https://crates.io/api/v1/crates?page=1&per_page=50&q=graphics&category=no-std

I suspect that there's probably a client-side JS snippet that would even render the response via the JS console but for now I've run out of time to investigate/write-up more.

@boringcactus
Copy link

Took a look at implementing this, but I don't know Ember, so I couldn't make much progress. However, I did throw together a separate frontend just for using the API for this feature, which might be of interest to those who find this issue in the meantime: https://cargo-search-category.glitch.me/

bors added a commit that referenced this issue Dec 28, 2021
tests/search: Add test case for query parameter forwarding

This should ensure to not break the functionality that was added in #1543 when working on implementing #491.
@bors bors closed this as completed in 82105a9 Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 A-search C-enhancement ✨ Category: Adding new behavior or a change to the way an existing feature works E-help-wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants