element/2.2/docs.8aa844e.js

1 line
323 KiB
JavaScript
Raw Normal View History

2018-03-15 03:33:59 +00:00
webpackJsonp([4],{107:function(e,t,o){function i(e,t){this.indexName=t,this.as=e,this.typeAheadArgs=null,this.typeAheadValueOption=null,this.cache={}}var l=o(108),r=o(74),n=o(75);e.exports=i,i.prototype.clearCache=function(){this.cache={}},i.prototype.search=l("query"),i.prototype.similarSearch=l("similarQuery"),i.prototype.browse=function(e,t,i){var l,r,n=o(109),a=this;0===arguments.length||1===arguments.length&&"function"==typeof arguments[0]?(l=0,i=arguments[0],e=void 0):"number"==typeof arguments[0]?(l=arguments[0],"number"==typeof arguments[1]?r=arguments[1]:"function"==typeof arguments[1]&&(i=arguments[1],r=void 0),e=void 0,t=void 0):"object"==typeof arguments[0]?("function"==typeof arguments[1]&&(i=arguments[1]),t=arguments[0],e=void 0):"string"==typeof arguments[0]&&"function"==typeof arguments[1]&&(i=arguments[1],t=void 0),t=n({},t||{},{page:l,hitsPerPage:r,query:e});var s=this.as._getSearchParams(t,"");return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a.indexName)+"/browse",body:{params:s},hostType:"read",callback:i})},i.prototype.browseFrom=function(e,t){return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/browse",body:{cursor:e},hostType:"read",callback:t})},i.prototype.searchForFacetValues=function(e,t){var i=o(23),l=o(564);if(void 0===e.facetName||void 0===e.facetQuery)throw new Error("Usage: index.searchForFacetValues({facetName, facetQuery, ...params}[, callback])");var r=e.facetName,n=l(i(e),function(e){return"facetName"===e}),a=this.as._getSearchParams(n,"");return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/facets/"+encodeURIComponent(r)+"/query",hostType:"read",body:{params:a},callback:t})},i.prototype.searchFacet=r(function(e,t){return this.searchForFacetValues(e,t)},n("index.searchFacet(params[, callback])","index.searchForFacetValues(params[, callback])")),i.prototype._search=function(e,t,o,i){return this.as._jsonRequest({cache:this.cache,method:"POST",url:t||"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:{params:e},hostType:"read",fallback:{method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName),body:{params:e}},callback:o,additionalUA:i})},i.prototype.getObject=function(e,t,o){var i=this;1!==arguments.length&&"function"!=typeof t||(o=t,t=void 0);var l="";if(void 0!==t){l="?attributes=";for(var r=0;r<t.length;++r)0!==r&&(l+=","),l+=t[r]}return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(i.indexName)+"/"+encodeURIComponent(e)+l,hostType:"read",callback:o})},i.prototype.getObjects=function(e,t,i){var l=o(9),r=o(36);if(!l(e))throw new Error("Usage: index.getObjects(arrayOfObjectIDs[, callback])");var n=this;1!==arguments.length&&"function"!=typeof t||(i=t,t=void 0);var a={requests:r(e,function(e){var o={indexName:n.indexName,objectID:e};return t&&(o.attributesToRetrieve=t.join(",")),o})};return this.as._jsonRequest({method:"POST",url:"/1/indexes/*/objects",hostType:"read",body:a,callback:i})},i.prototype.as=null,i.prototype.indexName=null,i.prototype.typeAheadArgs=null,i.prototype.typeAheadValueOption=null},108:function(e,t,o){function i(e,t){return function(o,i,r){if("function"==typeof o&&"object"==typeof i||"object"==typeof r)throw new l.AlgoliaSearchError("index.search usage is index.search(query, params, cb)");0===arguments.length||"function"==typeof o?(r=o,o=""):1!==arguments.length&&"function"!=typeof i||(r=i,i=void 0),"object"==typeof o&&null!==o?(i=o,o=void 0):void 0!==o&&null!==o||(o="");var n="";void 0!==o&&(n+=e+"="+encodeURIComponent(o));var a;return void 0!==i&&(i.additionalUA&&(a=i.additionalUA,delete i.additionalUA),n=this.as._getSearchParams(i,n)),this._search(n,t,r,a)}}e.exports=i;var l=o(29)},109:function(e,t,o){var i=o(30);e.exports=function e(t){var o=Array.prototype.slice.call(arguments);return i(o,function(o){for(var i in o)o.hasOwnProperty(i)&&("object"==typeof t[i]&&"object"==typeof o[i]?t[i]=e({},t[i],o[i]):void 0!==o[i]&&(t[i]=o[i]))}),t}},110:function(e,t){e.exports=function(e,t){t(e,0)}},111:functio