56bc02c4 by Adam Heath

Facets needs to do a direct call to look up suggestions, so make it use

the same sync method as Solr.
1 parent d5e4a434
...@@ -149,12 +149,17 @@ define(function(require) { ...@@ -149,12 +149,17 @@ define(function(require) {
149 return this; 149 return this;
150 }, 150 },
151 initialize: function(data, options) { 151 initialize: function(data, options) {
152 var solr = this;
152 options = (options || {}); 153 options = (options || {});
153 this.set('options', this._options = new Backbone.Model({ 154 this.set('options', this._options = new Backbone.Model({
154 faceting: !!options.faceting, 155 faceting: !!options.faceting,
155 highlighting: !!options.highlighting, 156 highlighting: !!options.highlighting,
156 showAll: !!options.showAll, 157 showAll: !!options.showAll,
157 })); 158 }));
159 var facets = this.get('facets');
160 facets.sync = function sync() {
161 return solr.sync.apply(this, arguments);
162 };
158 this._doSearchImmediately = _.bind(function(options) { 163 this._doSearchImmediately = _.bind(function(options) {
159 this.buildQueryParameters(); 164 this.buildQueryParameters();
160 this.fetch(_.extend({}, options, { 165 this.fetch(_.extend({}, options, {
...@@ -195,7 +200,7 @@ define(function(require) { ...@@ -195,7 +200,7 @@ define(function(require) {
195 this.on('change:currentPage', function(model, value, options) { 200 this.on('change:currentPage', function(model, value, options) {
196 this._doSearch(options); 201 this._doSearch(options);
197 }, this); 202 }, this);
198 this.get('facets').on('item-change', function(model, value, options) { 203 facets.on('item-change', function(model, value, options) {
199 this._doSearch(_.extend({}, options, {resetCurrentPage: true})); 204 this._doSearch(_.extend({}, options, {resetCurrentPage: true}));
200 }, this); 205 }, this);
201 this.get('ordering').on('change:value', function(model, value, options) { 206 this.get('ordering').on('change:value', function(model, value, options) {
......