Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Treat entire search string as token? #11

Open
Jorenm opened this issue Jul 19, 2014 · 1 comment
Open

Treat entire search string as token? #11

Jorenm opened this issue Jul 19, 2014 · 1 comment

Comments

@Jorenm
Copy link

Jorenm commented Jul 19, 2014

So "red car" would only match explicitly "red car", not red, car, reddit, carnage, etc.

@hagabaka
Copy link

I also think this should be added. I accomplished it with this hack:

// Treat search query as an entire token
    Sifter.prototype.tokenize = function(query) {
      if(!query || !query.length) {
        return [];
      } else {
        return [{
          string: query,
          regex: new RegExp(query, 'i')
        }];
      }
    };

It doesn't work if I just override tokenize for a single Sifter object for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants