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

Search only returns results for certain words #38

Open
npow opened this issue Oct 23, 2015 · 5 comments
Open

Search only returns results for certain words #38

npow opened this issue Oct 23, 2015 · 5 comments

Comments

@npow
Copy link

npow commented Oct 23, 2015

Somehow I cannot get search to find anything except if the query is work or pattern. Other terms like computer, lion and dog do not return any results. Test code is below. None of these terms are stopwords, so I don't understand why no results are found.

var assert = require('assert');
var uuid = require('node-uuid');
var PouchDB = require('pouchdb');
PouchDB.plugin(require('pouchdb-quick-search'));

var text = 'lion';

var db = new PouchDB('test-db');
var obj = {
  _id: uuid.v4(),
  text: text
};

function build(cb) {
  cb();
}

db.put(obj, function (err, res) {
  if (err) console.log(err, res);
  db.get(obj._id, function (err, o) {
    assert(!err && o._id === obj._id);

    var options = {
      query: text,
      fields: ['text'],
    };

    db.search(options, function (err, result) {
      assert(!err);
      assert(result.total_rows > 0);

      build(function (err) {
        assert(!err);

        db.search(options, function (err, result) {
          assert(!err);
          assert(result.total_rows > 0);
        });
      });
    });
  });
});
@faustlifes
Copy link

I have the same problem. Any my search options like:

var options = {
      query: text,
      fields: ['text'],
};

don't work and I always get 0 rows
I use angularjs 1.4.4

@nchatu
Copy link

nchatu commented May 3, 2016

I am also experiencing this issue

@nolanlawson
Copy link
Member

I'm not really actively maintaining this library anymore, but this sounds like almost certainly a bug in Lunr rather than this library. I encourage anybody with the time to look into it and fix it; maybe if I'm lucky, I just need to update the Lunr dep.

@npow
Copy link
Author

npow commented May 3, 2016

@nolanlawson You're right, I upgraded to lunr 0.7.0 and the issue seems to be fixed.

@nolanlawson
Copy link
Member

Cool, I'd be happy to accept a PR for the fix. :)

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

No branches or pull requests

4 participants