devdocs icon indicating copy to clipboard operation
devdocs copied to clipboard

Filter documentation via a query parameter for better browser interoperability

Open swh-tropic opened this issue 1 year ago • 5 comments

Feature request

Filter documentation via an optional query parameter

Summary

DevDocs makes it really easy to filter on a specific set of docs in the UI, which is great. I use this in conjunction with browser site search to pass queries directly to the DevDocs search endpoint to skip landing on the main page first. However, there is one disadvantage: I can't seem to filter the documentation from the search endpoint directly. If want to search for a ruby-specific method from site search, I need to land on the main DevDocs page and filter manually.

Browsers are embracing custom site search functionality to allow quick access to search endpoints that can be invoked via a shortcut and this has become an important part of my workflow. It would be great to have documentation filtering in the search API to improve the interoperability of DevDocs search.

Examples

The query endpoint looks like this:

https://devdocs.io/#q=%s where %s is replaced with my query string

It would be great to be able to do something like this to search only within Ruby 3.1: https://devdocs.io/#q=%s&doc=ruby3-1

swh-tropic avatar Aug 02 '23 18:08 swh-tropic

Any update on this? A language-specific endpoint for restricting the scope of search is very useful feature that can be integrated into many different workflows

ewh0 avatar Sep 02 '23 22:09 ewh0

@Thibaut any idea on this topic

ewh0 avatar Sep 02 '23 22:09 ewh0

I would love to work on this issue if it's available.

torresga avatar Oct 05 '23 16:10 torresga

DevDocs makes it really easy to filter on a specific set of docs in the UI

I actually couldn’t figure out how to do this in the DevDocs UI until I saw this thread’s confirmation that it was possible. The method I figured out:

  1. Focus the doc set you want to search within on the left, causing the URL to change from (for example) https://devdocs.io/ to https://devdocs.io/javascript/

    DevDocs left sidebar with JavaScript focused
  2. Refresh the page in your browser. The search box will now contain a bubble with the name of the filtered-on doc set:

    devdocs search area with JavaScript filter

You can press Delete to clear this doc set filter from the search field. However, refreshing the page will bring the filter back. If you want to clear the filter permanently, you have to go back the root page https://devdocs.io/.

Do you know of any other way to filter? I had wondered if DevDocs supported the same method as Dash of filtering queries using a prefix such as js: or javascript:, but no prefix I tried worked.

roryokane avatar May 16 '24 15:05 roryokane

There is no additional parameter for filtering a single documentation directly, but it is documented in the userguide that it is possible prefill the search field with something to search for and the documentation in which it should search:

Prefilling the search field The search can be prefilled from the URL by visiting devdocs.io/#q=keyword. Characters after #q= will be used as search query. To search a single documentation, add its name (or an abbreviation) and a space before the keyword: devdocs.io/#q=js date.

ClasherKasten avatar May 16 '24 15:05 ClasherKasten