879311b7 by Adam Heath

Split applyQueryParameters, into applyQueryString, to allow for outside

code to have a local instance of Solr, and pre-configured the search
terms.
1 parent b0833fc2
......@@ -75,16 +75,20 @@ define(function(require) {
};
},
applyQueryParameters: function() {
var queryStringMatch = document.location.href.match(/.*\?(.*)/);
this.applyQueryString(queryStringMatch ? queryStringMatch[1] : null);
},
applyQueryString: function(queryString) {
console.log('solr: applyQueryString', queryString);
var skipOptions = {skipSearch: true};
var parts = document.location.href.match(/.*\?(.*)/);
var facets = this.get('facets');
facets.resetParameters(skipOptions);
this.get('queryFields').resetParameters(skipOptions);
if (parts) {
if (queryString) {
var formNameMap = this.get('formNameMap');
var pagination = {};
var keyValueParts = parts[1].split('&');
var keyValueParts = queryString.split('&');
_.each(keyValueParts, function(keyValuePart, i) {
var keyFieldValue = keyValuePart.match(/^([^.]+)(?:\.([^.]+))?=(.*)$/);
if (keyFieldValue) {
......