add support for terms filter; related to 32f5977ac39df3df832b6b6b56152261a6ad7cd9

This commit is contained in:
kielni
2014-02-04 13:48:53 -08:00
parent 8c1a1359db
commit c275684ee9
2 changed files with 23 additions and 0 deletions

View File

@@ -101,6 +101,7 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {};
// register filters
var filterFunctions = {
term : term,
terms : terms,
range : range,
geo_distance : geo_distance
};
@@ -140,6 +141,14 @@ this.recline.Backend.Memory = this.recline.Backend.Memory || {};
return (value === term);
}
function terms(record, filter) {
var parse = getDataParser(filter);
var value = parse(record[filter.field]);
var terms = parse(filter.terms).split(",");
return (_.indexOf(terms, value) >= 0);
}
function range(record, filter) {
var fromnull = (_.isUndefined(filter.from) || filter.from === null || filter.from === '');
var tonull = (_.isUndefined(filter.to) || filter.to === null || filter.to === '');