Merge pull request #389 from kielni/terms-filter
add support for terms filter
This commit is contained in:
@@ -99,6 +99,13 @@ test('filters', function () {
|
||||
deepEqual(_.pluck(out.hits, 'country'), ['UK','UK','UK']);
|
||||
});
|
||||
|
||||
query = new recline.Model.Query();
|
||||
query.addFilter({type: 'terms', field: 'country', terms: ['UK','DE']});
|
||||
data.query(query.toJSON()).then(function(out) {
|
||||
equal(out.total, 5);
|
||||
deepEqual(_.pluck(out.hits, 'country'), ['DE','UK','UK','UK','DE']);
|
||||
});
|
||||
|
||||
query = new recline.Model.Query();
|
||||
query.addFilter({type: 'range', field: 'date', from: '2011-01-01', to: '2011-05-01'});
|
||||
data.query(query.toJSON()).then(function(out) {
|
||||
@@ -307,6 +314,13 @@ test('filters', function () {
|
||||
deepEqual(dataset.records.pluck('country'), ['UK', 'UK', 'UK']);
|
||||
});
|
||||
|
||||
dataset = makeBackendDataset();
|
||||
dataset.queryState.addFilter({type: 'terms', field: 'country', terms: ['UK','DE']});
|
||||
dataset.query().then(function() {
|
||||
equal(dataset.records.length, 5);
|
||||
deepEqual(dataset.records.pluck('country'), ['DE','UK', 'UK', 'UK','DE']);
|
||||
});
|
||||
|
||||
dataset = makeBackendDataset();
|
||||
dataset.queryState.addFilter({type: 'range', field: 'date', from: '2011-01-01', to: '2011-05-01'});
|
||||
dataset.query().then(function() {
|
||||
|
||||
Reference in New Issue
Block a user