| 1 |
define("analysis.client",["jquery.elasticsearch","analysis.visualizer"],function(){function a(){return h||b()}function b(a,b,c){return i={host:a,index:b,type:c},h=new jQuery.es.Client({hosts:a})}function c(b,c){console.debug("getMapping",typeof c);var d={index:i.index||"deafult",type:i.type||"profile"};return a().indices.getMapping(d).then(function(a){"function"==typeof c&&c.call(null,a["jezf-truq-qgox-hfxp"].mappings.profile||{},d)})}function d(b){console.debug("getResults",typeof handleResponse);var c={index:i.index||"deafult",type:i.type||"profile",from:0,size:0,body:b};return a().suggest(c).then(function(a){console.debug("getSuggestion","parseResponse",typeof a),"function"==typeof handleResponse&&handleResponse.call(null,null,a,"suggest",c)})}function e(b,c){console.debug("getMeta",typeof c);var d={index:i.index||"deafult",type:i.type||"profile"};return a().indices.getMapping(d).then(function(a){"function"==typeof c&&c.call(null,a["jezf-truq-qgox-hfxp"].mappings[i.type]._meta||{},"meta",d)})}function f(b,c,d){console.debug("getFacets",typeof d);var e={index:i.index||"deafult",type:i.type||"profile",from:0,size:0,body:{query:{filtered:{query:b}},facets:c}};return a().search(e).then(function(a){"function"==typeof d&&d.call(null,null,a.facets,"facets",e)}).then(function(a){console.debug("handleError",arguments),"function"==typeof d&&d.call(a,null,{},"facets",e)})}function g(b,c){console.debug("getResults",typeof c);var d={index:i.index||"deafult",type:i.type||"profile",from:0,size:0,body:b};return a().search(d).then(function(a){console.debug("getResults","parseResponse",typeof a),"function"==typeof c&&c.call(null,null,a,"search",d)})}console.debug("analysis.client","loaded");var h,i={};return{client:a,createClient:b,getSuggestion:d,getMeta:e,getMapping:c,getFacets:f,getResults:g}}); |