astral-sh / ruff

An extremely fast Python linter and code formatter, written in Rust.
https://docs.astral.sh/ruff
MIT License
31.73k stars 1.07k forks source link

Direct link when searching for a short code #13684

Open opk12 opened 3 days ago

opk12 commented 3 days ago

When I type a short code in the search bar on the website (https://docs.astral.sh/ruff), for example ruf005, the search suggestion is a link to the list of warnings. When I type a long code, for example collection-literal-concatenation, the search suggestion is a direct link to the warning's article. Could the short code case be changed?

MichaReiser commented 2 days ago

Hmm, that's unfortunate. We would have to look into our Algolia search configuration to see how it index pages and either change the Algolia configuration or the structure of the rule's page. I don't think I've access to Algolia (@charliermarsh )

charliermarsh commented 2 days ago

I think we'd need some sort of support in material-for-mkdocs, e.g., via https://squidfunk.github.io/mkdocs-material/plugins/search/.

squidfunk commented 1 day ago

Author of Material for MkDocs here – results should drastically improve once we release the new search, which is currently blocked by a bigger refactor we're working on in the background (@charliermarsh we talked about this recently), as mentioned in our latest blog post. Once we got a first version of that ready, we'll reach out to you for giving it a try ☺️ We estimate that this should be the case by the beginning of next year.

In the meantime, as a bandaid, you should be able to improve discovery by using tags, and tagging each rule with its modifier. Tags currently take precedence over everything else in search:

---
tags:
- ruf005
---

# Tag name
MichaReiser commented 1 day ago

Wow thanks @squidfunk for the details! Adding the tags should be a very straightforward change and looking forward to the new search engine