1 (function (callback) { 2 if (typeof define === 'function' && define.amd) { 3 define(['core/AbstractManager'], callback); 4 } 5 else { 6 callback(); 7 } 8 }(function () { 9 10 /** 11 * @see http://wiki.apache.org/solr/SolJSON#JSON_specific_parameters 12 * @class Manager 13 * @augments AjaxSolr.AbstractManager 14 */ 15 AjaxSolr.Manager = AjaxSolr.AbstractManager.extend( 16 /** @lends AjaxSolr.Manager.prototype */ 17 { 18 executeRequest: function (servlet, string, handler, errorHandler) { 19 var self = this, 20 options = {dataType: 'json'}; 21 string = string || this.store.string(); 22 handler = handler || function (data) { 23 self.handleResponse(data); 24 }; 25 errorHandler = errorHandler || function (jqXHR, textStatus, errorThrown) { 26 self.handleError(textStatus + ', ' + errorThrown); 27 }; 28 if (this.proxyUrl) { 29 options.url = this.proxyUrl; 30 options.data = {query: string}; 31 options.type = 'POST'; 32 } 33 else { 34 options.url = this.solrUrl + servlet + '?' + string + '&wt=json&json.wrf=?'; 35 } 36 jQuery.ajax(options).done(handler).fail(errorHandler); 37 } 38 }); 39 40 })); 41