[#154,model/query][m]: refactor to new filter structure (see ticket) updating FilterEditor widget and backends.

* ElasticSearch changes represents a significant refactor and now support filters and query via constant_score (did not support this before!)
This commit is contained in:
Rufus Pollock
2012-06-16 13:04:03 +01:00
parent 617d3440f0
commit f14dcdcaaf
8 changed files with 124 additions and 100 deletions

View File

@@ -151,27 +151,23 @@ test('Query', function () {
test('Query.addFilter', function () {
var query = new recline.Model.Query();
query.addFilter('term', 'xyz');
query.addFilter({type: 'term', field: 'xyz'});
var exp = {
term: {
xyz: '',
_field: 'xyz',
_type: 'term'
}
field: 'xyz',
type: 'term',
term: ''
};
deepEqual(exp, query.get('filters')[0]);
deepEqual(query.get('filters')[0], exp);
query.addFilter('geo_distance', 'xyz');
query.addFilter({type: 'geo_distance', field: 'xyz'});
var exp = {
geo_distance: {
distance: '10km',
xyz: {
lon: 0,
lat: 0
},
_field: 'xyz',
_type: 'geo_distance'
}
distance: '10km',
point: {
lon: 0,
lat: 0
},
field: 'xyz',
type: 'geo_distance'
};
deepEqual(exp, query.get('filters')[1]);
});