100be003 by Adam Heath

Breaking change; fix global singleton issue around Facets.

1 parent 5060c174
...@@ -4,6 +4,7 @@ define(function(require) { ...@@ -4,6 +4,7 @@ define(function(require) {
4 var Backbone = require('backbone'); 4 var Backbone = require('backbone');
5 5
6 var Facets = require('solr/model/Facets'); 6 var Facets = require('solr/model/Facets');
7 var Facet = require('solr/model/Facet');
7 var Ordering = require('solr/model/Ordering'); 8 var Ordering = require('solr/model/Ordering');
8 var QueryTextField = require('solr/model/QueryTextField'); 9 var QueryTextField = require('solr/model/QueryTextField');
9 var Util = require('solr/model/Util'); 10 var Util = require('solr/model/Util');
...@@ -24,7 +25,11 @@ define(function(require) { ...@@ -24,7 +25,11 @@ define(function(require) {
24 defaults: function defaults() { 25 defaults: function defaults() {
25 var constructor = this.constructor; 26 var constructor = this.constructor;
26 var formNameMap = {}; 27 var formNameMap = {};
27 var facets = new Facets(this.constructor.facets, {search: this}); 28 var constructorFacets = {};
29 _.each(this.constructor.facets, function(facetInfo, facetName) {
30 constructorFacets[facetName] = new Facet(facetInfo.data, facetInfo.options);
31 });
32 var facets = new Facets(constructorFacets, {search: this});
28 _.each(facets.values(), function(facet) { 33 _.each(facets.values(), function(facet) {
29 var formName = facet.get('formName'); 34 var formName = facet.get('formName');
30 if (formName) { 35 if (formName) {
......