curious search result order on docs.ruby-lang.org
If you search for "String" on https://docs.ruby-lang.org/en/3.3/ the first four results returned are obscure:
Gem::SafeMarshal::Elements::String Prism::StringFlags Prism::StringNode Reline::Terminfo::StringWithTiparm String
Would it be possible to change it so that if one types an exact class name, the class of that name is first on the list? This would make it easier to use the search feature. More generally, the prioritization of these results is surprising.
I reported this at https://bugs.ruby-lang.org/issues/20722 and was directed here. Apologies if this is the wrong place.
I'm not sure if this is the version that's on https://docs.ruby-lang.org right now, but searching for String or Hash is not putting the class with exact match at the top. There are a lot of exact match methods coming before the class, which would rarely be what someone searching for 'String' or 'Hash' would want. You have to scroll down quite a ways for the Hash class and since every word is 'hash' or 'Hash' it's pretty hard to find.
@wlipa Yeah it should be improved. A PR would be appreciated 😄
@st0012 or anyone keen to jump on this, something I do in rubyapi.org is assign a search result weight based on the namespace depth. Objects like String, Integer etc would be given the highest weight, then Prism::StringNode would be weighted 1/2, Reline::Terminfo::StringWithTiparm would be 1/3 etc etc.
https://github.com/rubyapi/rubyapi/blob/9f722c0a223e1ab3d24c745ac19acb3c5cf8a208/app/models/ruby_constant.rb#L27-L28