homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients docs@python, eric.araujo, ezio.melotti, georg.brandl, r.david.murray, skrah, terry.reedy
Date 2012年09月08日.12:51:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347108690.53.0.103884042484.issue15871@psf.upfronthosting.co.za>
In-reply-to
Content
If I search for "random", at the top of the result lists I want to see at least the "random" module and the "random.random" function.
Currently the "random" module is the 4th result, and "random.random" is buried down in the list (17th place) among all the other random.* functions.
The results are generated by the query() function in searchtools.js, and AFAIU it generates 3 lists, importantResults, objectResults, unimportantResults, that get then sorted independently in alphabetic order by the object fullname, and concatenated.
I experimented a bit and one way to get exact matches to the top is to add before the switch at line 370 something like 
if (fullname == object) {
 importantResults.push(result);
 continue;
}
This will include "random", but not "random.random".
Other possible variations are 
 if ((fullname == object) || (fullname.split('.').pop() == object)) {
or
 if ((fullname == object) || $.inArray(object, fullname.split('.')) > -1)
Here fullname is e.g. "random.random", "$.inArray(object, fullname.split('.')) > -1" is the jquery equivalent of Python's "object in fullname.split('.')".
Another way to address the problem is to change the sorting algorithm to move near the top results like "random" and "random.random".
History
Date User Action Args
2012年09月08日 12:51:30ezio.melottisetrecipients: + ezio.melotti, georg.brandl, terry.reedy, eric.araujo, r.david.murray, skrah, docs@python
2012年09月08日 12:51:30ezio.melottisetmessageid: <1347108690.53.0.103884042484.issue15871@psf.upfronthosting.co.za>
2012年09月08日 12:51:30ezio.melottilinkissue15871 messages
2012年09月08日 12:51:29ezio.melotticreate

AltStyle によって変換されたページ (->オリジナル) /