Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


search tool doesn't do a great job #2016

valtido opened this Issue · 8 comments

6 participants


I typed jQuery, I got everything apart from jQuery itself...

I think the search func should be looked a bit more closer.


Perhaps, whatever works, but yeah it could get more traction should it find what you are looking for...

I have seen where people split each character and use wild cards so e.g:

Search: user


I would like to see regex added so that I could find jQuery with "^jquery$"


I was able to shoehorn this in by pasting thing into the JS console:

# from
jQuery.expr[':'].regex = function(elem, index, match) {
    var matchParams = match[3].split(','),
        validLabels = /^(data|css):/,
        attr = {
            method: matchParams[0].match(validLabels) ? 
                        matchParams[0].split(':')[0] : 'attr',
            property: matchParams.shift().replace(validLabels,'')
        regexFlags = 'ig',
        regex = new RegExp(matchParams.join('').replace(/^\s+|\s+$/g,''), regexFlags);
    return regex.test(jQuery(elem)[attr.method](;

Then I could search for the jQuery <tr> by [regex] name via:


The I could show only the one I wanted via:

jQuery("[data-library-name]").hide(); jQuery(':regex(data-library-name,^jquery$)').show()

Worked like a charm!

I'd like to propose that at a minimum, we change this:

# line#31/partial 
        (e("[data-library-name]").hide(), e('[data-library-name*="' + n + '"]').show(), e('[data-library-keywords*="' + n + '"]').show())


# line#31/partial 
        (e("[data-library-name]").hide(), e(':regex(data-library-name,' + n + ')').show(), e(':regex(data-library-keywords,' + n + ')').show())

Ideally, I'd like to add in the ability to search with "scope prefixes" similar to doing from:richard in Gmail. In this case that would be: name:jquery and keywords:testing and keyword:testing


Collating search-related issues: #1829


It might also be useful to weight on the string length as well. So searching on "jquer", jquery would be weighted higher than jquery-ui, which would be weighted higher than jquery-history.

The rationale is that "jquery" is a more exact match than "jquery-ui". They'd each come up, but the sort order would prefer "jquery".


This is fixed. I implemented search based on Damerau–Levenshtein distance and some other simple heuristics.

@jimothyGator This has the effect of weighting smaller library names higher as the edit distance is smaller between "jquer" and "jquery" than "jquery-validate".

@valtido A search for "jquery" will result in jquery being at the top now :)

@ryankirkman ryankirkman closed this

@ryankirkman - you are THE MAN. I did a search today for jquery and it finally appears at the top! This always bugged me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.