gh-138277: Elevate Built-in Types and Functions in Documentation Search#138278
gh-138277: Elevate Built-in Types and Functions in Documentation Search#138278adqm wants to merge 6 commits intopython:mainfrom
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
skirpichev
left a comment
There was a problem hiding this comment.
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 |
skirpichev
left a comment
There was a problem hiding this comment.
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:
strtype goes from being the 44th result to the 1st.settype goes from being the 14th result to the 1st.inttype now shows up abovetkinterandpprint.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/