-
-
Notifications
You must be signed in to change notification settings - Fork 33k
gh-138277: Elevate Built-in Types and Functions in Documentation Search #138278
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
base: main
Are you sure you want to change the base?
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm played with this a bit and I generally like new search output 👍
...to try to keep most search results roughly where they currently are.
Thanks for taking a look, @skirpichev! I just pushed a few changes, adding some comments and tweaking the scoring a little bit (to adjust one value that I inadvertently changed from the sphinx defaults that was affecting the ordering more than I intended). Looking around a bit more, though, I am wondering if it might be better to do this with a Sphinx object domain, though, setting the builtin things to be important. But I'm not sure if there's an easy way to do that without hard-coding all of the built-in objects somewhere. @AA-Turner might know better. Then again, some of the other changes I had been thinking of probably do require a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The file does not belong in the root Doc
dir, please move it to Doc/tools/static
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look good for me, modulo Stan's comment.
I am wondering if it might be better to do this with a Sphinx object domain, though, setting the builtin things to be important
Probably, the right way might be a mixture of both.
Thanks! I went ahead and moved the file into |
This patch adds a custom search scorer for the Python docs, in the hopes of making the search results more useful. For now, this just increases the score of built-in functions and types so that they show up closer to the top of the relevant search results, though it also opens the door to other improvements. I also have a couple of other ideas that might further improve the ordering, but I figured it'd be best to start small.
With this change:
str
type goes from being the 44th result to the 1st.set
type goes from being the 14th result to the 1st.int
type now shows up abovetkinter
andpprint
.I don't think this needs a news item, but I can add one if y'all think it's necessary.
📚 Documentation preview 📚: https://cpython-previews--138278.org.readthedocs.build/