itemsapi / itemsjs

Extremely fast faceted search engine in JavaScript - lightweight, flexible, and simple to use

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Paged filtered search not returning items

joostmeijles opened this issue · comments

commented

When using filter with paging I do not get any results back.

Test case:

it('paged filtered search', function test(done) {
    const items = [{ id: 1 }, { id: 2 }, { id: 3 }];
    const index = require('./../index')(items);
    
    const res = index.search({
      query: '',
      page: 2,
      per_page: 1,
      filter: (item) => item.id > 1,
    });
    assert.deepEqual(res.data.items, [{ _id: 3, id: 3 }]);

    done();
  });

Is this a bug or am I using it wrongly?

commented

Fixed #88