Skip to content
This repository has been archived by the owner on Mar 21, 2019. It is now read-only.

Search results page #350

Closed
abrahammartin opened this issue Oct 5, 2018 · 1 comment · Fixed by #380
Closed

Search results page #350

abrahammartin opened this issue Oct 5, 2018 · 1 comment · Fixed by #380
Assignees
Labels

Comments

@abrahammartin
Copy link
Member

abrahammartin commented Oct 5, 2018

Improve the UI of the current search results page, perhaps using a similar layout as Github which allows to select which object the user wants to see the results for.

screenshot 2018-10-05 at 16 06 27

@rjw57
Copy link
Member

rjw57 commented Oct 9, 2018

@msb and myself sketched this out on a whiteboard. We think that this can be done by improving the existing search API to use Django's full text search API. The per-resource type lists can then be populated using the existing API.

This brings us to the list on the left. Looking at how GitHub does it, the search counts on the left are loaded asynchronously and can appear some seconds after the page load. E.g., https://github.com/search?q=linux takes up to two seconds to fill all the numbers in.

Unfortunately we currently use CursorPagination which does not support counting the number of resources. Adding the count for all calls would be inefficient; counts are expensive to compute. One option is to add a countOnly parameter so that, e.g. /api/playlists/?search={query}&countOnly would return

{
    "resultCount": 12345
}

With this change the numbers next to the resources can be filled in asynchronously by fetching /api/{resourceType}/?search={query}&countOnly.

So, this story's bit of #348 becomes:

  1. Change the existing /api/{playlists,channels,media}?search={query} API to use full-text search for the query.
  2. Add a "countOnly" parameter to the resource list which returns simply a count of the resources. (This may require implementing a custom paginator based on CursorPagination?)

And the bit required for this story is:

  1. Implement a new /search page in the UI which uses the API to populate the individual lists of resources by type and the new "countOnly" query to populate the numbers.

@msb msb added 3 and removed needs sizing labels Oct 15, 2018
@msb msb self-assigned this Oct 15, 2018
@abrahammartin abrahammartin added 1.5 and removed 3 labels Oct 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants