mirror of
https://github.com/only-cli/oc.git
synced 2026-09-15 10:40:56 +02:00
prototype a Sphinx search backend for the Python docs
docs.python.org has no search server: its search page downloads the whole Sphinx index (searchindex.js, ~900KB gzipped) and ranks matches in the browser. oc now does the same ranking itself, so 'oc py search' answers from the site's own index instead of DuckDuckGo. The index is cached on disk for a day and never printed; what renders is a numbered result list that rides the normal open path, so 'do <n>' follows a result. A query that names a symbol exactly (json.dumps) links straight to its anchor. A site definition opts in with a 'sphinx' field naming the docs root, so any Sphinx site can use the backend later.
This commit is contained in:
@@ -3,6 +3,6 @@
|
||||
"commands": {
|
||||
"library": { "open": "https://docs.python.org/3/library/{module}.html", "args": ["module"] },
|
||||
"doc": { "open": "https://docs.python.org/3/{path}.html", "args": ["path"] },
|
||||
"search": { "open": "https://html.duckduckgo.com/html/?q=site%3Adocs.python.org+{query}", "args": ["query"] }
|
||||
"search": { "sphinx": "https://docs.python.org/3/", "args": ["query"] }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user