Ezio Melotti added the comment:
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".
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15871>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com