algoliasearch 3.25.0 → 3.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +1 -0
- package/bower.json +1 -1
- package/dist/algoliasearch.angular.js +120 -34
- package/dist/algoliasearch.angular.min.js +4 -4
- package/dist/algoliasearch.jquery.js +120 -34
- package/dist/algoliasearch.jquery.min.js +4 -4
- package/dist/algoliasearch.js +117 -34
- package/dist/algoliasearch.min.js +4 -4
- package/dist/algoliasearch.parse.js +115 -32
- package/dist/algoliasearchLite.js +74 -6
- package/dist/algoliasearchLite.min.js +3 -3
- package/package.json +6 -2
- package/src/AlgoliaSearch.js +1 -1
- package/src/AlgoliaSearchCore.js +68 -3
- package/src/Index.js +42 -27
- package/src/browser/builds/algoliasearch.angular.js +3 -0
- package/src/browser/builds/algoliasearch.jquery.js +3 -0
- package/src/browser/createAlgoliasearch.js +3 -0
- package/src/reactnative/builds/algoliasearch.reactnative.js +3 -0
- package/src/server/builds/node.js +3 -0
- package/src/server/builds/parse.js +3 -0
- package/src/version.js +1 -1
|
@@ -163,6 +163,9 @@ module.exports =
|
|
|
163
163
|
_setTimeout(promise.resolve.bind(promise), ms);
|
|
164
164
|
|
|
165
165
|
return promise;
|
|
166
|
+
},
|
|
167
|
+
all: function all(promises) {
|
|
168
|
+
return Parse.Promise.all(promises);
|
|
166
169
|
}
|
|
167
170
|
};
|
|
168
171
|
|
|
@@ -565,7 +568,7 @@ module.exports =
|
|
|
565
568
|
* content: the server answer with the added API key
|
|
566
569
|
* @return {Promise|undefined} Returns a promise if no callback given
|
|
567
570
|
* @example
|
|
568
|
-
* client.
|
|
571
|
+
* client.addApiKey(['search'], {
|
|
569
572
|
* validity: 300,
|
|
570
573
|
* maxQueriesPerIPPerHour: 2000,
|
|
571
574
|
* maxHitsPerQuery: 3,
|
|
@@ -1763,6 +1766,7 @@ module.exports =
|
|
|
1763
1766
|
* Retrieve all the query rules in an index
|
|
1764
1767
|
* @param [number=100] hitsPerPage The amount of query rules to retrieve per batch
|
|
1765
1768
|
* @param [function] callback will be called after all query rules are retrieved
|
|
1769
|
+
* error: null or Error('message')
|
|
1766
1770
|
*/
|
|
1767
1771
|
Index.prototype.exportRules = function(hitsPerPage, callback) {
|
|
1768
1772
|
return exportData(this.searchRules.bind(this), hitsPerPage, callback);
|
|
@@ -1776,6 +1780,10 @@ module.exports =
|
|
|
1776
1780
|
opts = {};
|
|
1777
1781
|
}
|
|
1778
1782
|
|
|
1783
|
+
if (!rule.objectID) {
|
|
1784
|
+
throw new errors.AlgoliaSearchError('Missing or empty objectID field for rule');
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1779
1787
|
var forwardToReplicas = opts.forwardToReplicas === true ? 'true' : 'false';
|
|
1780
1788
|
|
|
1781
1789
|
return this.as._jsonRequest({
|
|
@@ -1948,11 +1956,11 @@ module.exports =
|
|
|
1948
1956
|
};
|
|
1949
1957
|
|
|
1950
1958
|
/*
|
|
1951
|
-
|
|
1952
|
-
|
|
1959
|
+
* @deprecated see client.listApiKeys()
|
|
1960
|
+
*/
|
|
1953
1961
|
Index.prototype.listUserKeys = deprecate(function(callback) {
|
|
1954
1962
|
return this.listApiKeys(callback);
|
|
1955
|
-
}, deprecatedMessage('index.listUserKeys()', '
|
|
1963
|
+
}, deprecatedMessage('index.listUserKeys()', 'client.listApiKeys()'));
|
|
1956
1964
|
|
|
1957
1965
|
/*
|
|
1958
1966
|
* List all existing API keys to this index
|
|
@@ -1960,8 +1968,10 @@ module.exports =
|
|
|
1960
1968
|
* @param callback the result callback called with two arguments
|
|
1961
1969
|
* error: null or Error('message')
|
|
1962
1970
|
* content: the server answer with API keys belonging to the index
|
|
1971
|
+
*
|
|
1972
|
+
* @deprecated see client.listApiKeys()
|
|
1963
1973
|
*/
|
|
1964
|
-
Index.prototype.listApiKeys = function(callback) {
|
|
1974
|
+
Index.prototype.listApiKeys = deprecate(function(callback) {
|
|
1965
1975
|
var indexObj = this;
|
|
1966
1976
|
return this.as._jsonRequest({
|
|
1967
1977
|
method: 'GET',
|
|
@@ -1969,14 +1979,14 @@ module.exports =
|
|
|
1969
1979
|
hostType: 'read',
|
|
1970
1980
|
callback: callback
|
|
1971
1981
|
});
|
|
1972
|
-
};
|
|
1982
|
+
}, deprecatedMessage('index.listApiKeys()', 'client.listApiKeys()'));
|
|
1973
1983
|
|
|
1974
1984
|
/*
|
|
1975
|
-
|
|
1976
|
-
|
|
1985
|
+
* @deprecated see client.getApiKey()
|
|
1986
|
+
*/
|
|
1977
1987
|
Index.prototype.getUserKeyACL = deprecate(function(key, callback) {
|
|
1978
1988
|
return this.getApiKey(key, callback);
|
|
1979
|
-
}, deprecatedMessage('index.getUserKeyACL()', '
|
|
1989
|
+
}, deprecatedMessage('index.getUserKeyACL()', 'client.getApiKey()'));
|
|
1980
1990
|
|
|
1981
1991
|
|
|
1982
1992
|
/*
|
|
@@ -1986,8 +1996,10 @@ module.exports =
|
|
|
1986
1996
|
* @param callback the result callback called with two arguments
|
|
1987
1997
|
* error: null or Error('message')
|
|
1988
1998
|
* content: the server answer with the right API key
|
|
1999
|
+
*
|
|
2000
|
+
* @deprecated see client.getApiKey()
|
|
1989
2001
|
*/
|
|
1990
|
-
Index.prototype.getApiKey = function(key, callback) {
|
|
2002
|
+
Index.prototype.getApiKey = deprecate(function(key, callback) {
|
|
1991
2003
|
var indexObj = this;
|
|
1992
2004
|
return this.as._jsonRequest({
|
|
1993
2005
|
method: 'GET',
|
|
@@ -1995,14 +2007,14 @@ module.exports =
|
|
|
1995
2007
|
hostType: 'read',
|
|
1996
2008
|
callback: callback
|
|
1997
2009
|
});
|
|
1998
|
-
};
|
|
2010
|
+
}, deprecatedMessage('index.getApiKey()', 'client.getApiKey()'));
|
|
1999
2011
|
|
|
2000
2012
|
/*
|
|
2001
|
-
|
|
2002
|
-
|
|
2013
|
+
* @deprecated see client.deleteApiKey()
|
|
2014
|
+
*/
|
|
2003
2015
|
Index.prototype.deleteUserKey = deprecate(function(key, callback) {
|
|
2004
2016
|
return this.deleteApiKey(key, callback);
|
|
2005
|
-
}, deprecatedMessage('index.deleteUserKey()', '
|
|
2017
|
+
}, deprecatedMessage('index.deleteUserKey()', 'client.deleteApiKey()'));
|
|
2006
2018
|
|
|
2007
2019
|
/*
|
|
2008
2020
|
* Delete an existing API key associated to this index
|
|
@@ -2011,8 +2023,10 @@ module.exports =
|
|
|
2011
2023
|
* @param callback the result callback called with two arguments
|
|
2012
2024
|
* error: null or Error('message')
|
|
2013
2025
|
* content: the server answer with the deletion date
|
|
2026
|
+
*
|
|
2027
|
+
* @deprecated see client.deleteApiKey()
|
|
2014
2028
|
*/
|
|
2015
|
-
Index.prototype.deleteApiKey = function(key, callback) {
|
|
2029
|
+
Index.prototype.deleteApiKey = deprecate(function(key, callback) {
|
|
2016
2030
|
var indexObj = this;
|
|
2017
2031
|
return this.as._jsonRequest({
|
|
2018
2032
|
method: 'DELETE',
|
|
@@ -2020,14 +2034,14 @@ module.exports =
|
|
|
2020
2034
|
hostType: 'write',
|
|
2021
2035
|
callback: callback
|
|
2022
2036
|
});
|
|
2023
|
-
};
|
|
2037
|
+
}, deprecatedMessage('index.deleteApiKey()', 'client.deleteApiKey()'));
|
|
2024
2038
|
|
|
2025
2039
|
/*
|
|
2026
|
-
|
|
2027
|
-
|
|
2040
|
+
* @deprecated see client.addApiKey()
|
|
2041
|
+
*/
|
|
2028
2042
|
Index.prototype.addUserKey = deprecate(function(acls, params, callback) {
|
|
2029
2043
|
return this.addApiKey(acls, params, callback);
|
|
2030
|
-
}, deprecatedMessage('index.addUserKey()', '
|
|
2044
|
+
}, deprecatedMessage('index.addUserKey()', 'client.addApiKey()'));
|
|
2031
2045
|
|
|
2032
2046
|
/*
|
|
2033
2047
|
* Add a new API key to this index
|
|
@@ -2064,8 +2078,10 @@ module.exports =
|
|
|
2064
2078
|
* }
|
|
2065
2079
|
* })
|
|
2066
2080
|
* @see {@link https://www.algolia.com/doc/rest_api#AddIndexKey|Algolia REST API Documentation}
|
|
2081
|
+
*
|
|
2082
|
+
* @deprecated see client.addApiKey()
|
|
2067
2083
|
*/
|
|
2068
|
-
Index.prototype.addApiKey = function(acls, params, callback) {
|
|
2084
|
+
Index.prototype.addApiKey = deprecate(function(acls, params, callback) {
|
|
2069
2085
|
var isArray = __webpack_require__(16);
|
|
2070
2086
|
var usage = 'Usage: index.addApiKey(arrayOfAcls[, params, callback])';
|
|
2071
2087
|
|
|
@@ -2102,21 +2118,21 @@ module.exports =
|
|
|
2102
2118
|
hostType: 'write',
|
|
2103
2119
|
callback: callback
|
|
2104
2120
|
});
|
|
2105
|
-
};
|
|
2121
|
+
}, deprecatedMessage('index.addApiKey()', 'client.addApiKey()'));
|
|
2106
2122
|
|
|
2107
2123
|
/**
|
|
2108
|
-
* @deprecated use
|
|
2124
|
+
* @deprecated use client.addApiKey()
|
|
2109
2125
|
*/
|
|
2110
2126
|
Index.prototype.addUserKeyWithValidity = deprecate(function deprecatedAddUserKeyWithValidity(acls, params, callback) {
|
|
2111
2127
|
return this.addApiKey(acls, params, callback);
|
|
2112
|
-
}, deprecatedMessage('index.addUserKeyWithValidity()', '
|
|
2128
|
+
}, deprecatedMessage('index.addUserKeyWithValidity()', 'client.addApiKey()'));
|
|
2113
2129
|
|
|
2114
2130
|
/*
|
|
2115
|
-
|
|
2116
|
-
|
|
2131
|
+
* @deprecated see client.updateApiKey()
|
|
2132
|
+
*/
|
|
2117
2133
|
Index.prototype.updateUserKey = deprecate(function(key, acls, params, callback) {
|
|
2118
2134
|
return this.updateApiKey(key, acls, params, callback);
|
|
2119
|
-
}, deprecatedMessage('index.updateUserKey()', '
|
|
2135
|
+
}, deprecatedMessage('index.updateUserKey()', 'client.updateApiKey()'));
|
|
2120
2136
|
|
|
2121
2137
|
/**
|
|
2122
2138
|
* Update an existing API key of this index
|
|
@@ -2153,8 +2169,10 @@ module.exports =
|
|
|
2153
2169
|
* }
|
|
2154
2170
|
* })
|
|
2155
2171
|
* @see {@link https://www.algolia.com/doc/rest_api#UpdateIndexKey|Algolia REST API Documentation}
|
|
2172
|
+
*
|
|
2173
|
+
* @deprecated see client.updateApiKey()
|
|
2156
2174
|
*/
|
|
2157
|
-
Index.prototype.updateApiKey = function(key, acls, params, callback) {
|
|
2175
|
+
Index.prototype.updateApiKey = deprecate(function(key, acls, params, callback) {
|
|
2158
2176
|
var isArray = __webpack_require__(16);
|
|
2159
2177
|
var usage = 'Usage: index.updateApiKey(key, arrayOfAcls[, params, callback])';
|
|
2160
2178
|
|
|
@@ -2191,7 +2209,7 @@ module.exports =
|
|
|
2191
2209
|
hostType: 'write',
|
|
2192
2210
|
callback: callback
|
|
2193
2211
|
});
|
|
2194
|
-
};
|
|
2212
|
+
}, deprecatedMessage('index.updateApiKey()', 'client.updateApiKey()'));
|
|
2195
2213
|
|
|
2196
2214
|
|
|
2197
2215
|
/***/ }),
|
|
@@ -3185,7 +3203,6 @@ module.exports =
|
|
|
3185
3203
|
|
|
3186
3204
|
opts = opts || {};
|
|
3187
3205
|
|
|
3188
|
-
var protocol = opts.protocol || 'https:';
|
|
3189
3206
|
this._timeouts = opts.timeouts || {
|
|
3190
3207
|
connect: 1 * 1000, // 500ms connect is GPRS latency
|
|
3191
3208
|
read: 2 * 1000,
|
|
@@ -3197,13 +3214,14 @@ module.exports =
|
|
|
3197
3214
|
this._timeouts.connect = this._timeouts.read = this._timeouts.write = opts.timeout;
|
|
3198
3215
|
}
|
|
3199
3216
|
|
|
3217
|
+
var protocol = opts.protocol || 'https:';
|
|
3200
3218
|
// while we advocate for colon-at-the-end values: 'http:' for `opts.protocol`
|
|
3201
3219
|
// we also accept `http` and `https`. It's a common error.
|
|
3202
3220
|
if (!/:$/.test(protocol)) {
|
|
3203
3221
|
protocol = protocol + ':';
|
|
3204
3222
|
}
|
|
3205
3223
|
|
|
3206
|
-
if (
|
|
3224
|
+
if (protocol !== 'http:' && protocol !== 'https:') {
|
|
3207
3225
|
throw new errors.AlgoliaSearchError('protocol must be `http:` or `https:` (was `' + opts.protocol + '`)');
|
|
3208
3226
|
}
|
|
3209
3227
|
|
|
@@ -3215,7 +3233,8 @@ module.exports =
|
|
|
3215
3233
|
});
|
|
3216
3234
|
|
|
3217
3235
|
// no hosts given, compute defaults
|
|
3218
|
-
|
|
3236
|
+
var mainSuffix = (opts.dsn === false ? '' : '-dsn') + '.algolia.net';
|
|
3237
|
+
this.hosts.read = [this.applicationID + mainSuffix].concat(defaultHosts);
|
|
3219
3238
|
this.hosts.write = [this.applicationID + '.algolia.net'].concat(defaultHosts);
|
|
3220
3239
|
} else if (isArray(opts.hosts)) {
|
|
3221
3240
|
// when passing custom hosts, we need to have a different host index if the number
|
|
@@ -3729,6 +3748,70 @@ module.exports =
|
|
|
3729
3748
|
});
|
|
3730
3749
|
};
|
|
3731
3750
|
|
|
3751
|
+
/**
|
|
3752
|
+
* Search for facet values
|
|
3753
|
+
* https://www.algolia.com/doc/rest-api/search#search-for-facet-values
|
|
3754
|
+
* This is the top-level API for SFFV.
|
|
3755
|
+
*
|
|
3756
|
+
* @param {object[]} queries An array of queries to run.
|
|
3757
|
+
* @param {string} queries[].indexName Index name, name of the index to search.
|
|
3758
|
+
* @param {object} queries[].params Query parameters.
|
|
3759
|
+
* @param {string} queries[].params.facetName Facet name, name of the attribute to search for values in.
|
|
3760
|
+
* Must be declared as a facet
|
|
3761
|
+
* @param {string} queries[].params.facetQuery Query for the facet search
|
|
3762
|
+
* @param {string} [queries[].params.*] Any search parameter of Algolia,
|
|
3763
|
+
* see https://www.algolia.com/doc/api-client/javascript/search#search-parameters
|
|
3764
|
+
* Pagination is not supported. The page and hitsPerPage parameters will be ignored.
|
|
3765
|
+
*/
|
|
3766
|
+
AlgoliaSearchCore.prototype.searchForFacetValues = function(queries) {
|
|
3767
|
+
var isArray = __webpack_require__(16);
|
|
3768
|
+
var map = __webpack_require__(17);
|
|
3769
|
+
|
|
3770
|
+
var usage = 'Usage: client.searchForFacetValues([{indexName, params: {facetName, facetQuery, ...params}}, ...queries])'; // eslint-disable-line max-len
|
|
3771
|
+
|
|
3772
|
+
if (!isArray(queries)) {
|
|
3773
|
+
throw new Error(usage);
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
var client = this;
|
|
3777
|
+
|
|
3778
|
+
return client._promise.all(map(queries, function performQuery(query) {
|
|
3779
|
+
if (
|
|
3780
|
+
!query ||
|
|
3781
|
+
query.indexName === undefined ||
|
|
3782
|
+
query.params.facetName === undefined ||
|
|
3783
|
+
query.params.facetQuery === undefined
|
|
3784
|
+
) {
|
|
3785
|
+
throw new Error(usage);
|
|
3786
|
+
}
|
|
3787
|
+
|
|
3788
|
+
var clone = __webpack_require__(12);
|
|
3789
|
+
var omit = __webpack_require__(13);
|
|
3790
|
+
|
|
3791
|
+
var indexName = query.indexName;
|
|
3792
|
+
var params = query.params;
|
|
3793
|
+
|
|
3794
|
+
var facetName = params.facetName;
|
|
3795
|
+
var filteredParams = omit(clone(params), function(keyName) {
|
|
3796
|
+
return keyName === 'facetName';
|
|
3797
|
+
});
|
|
3798
|
+
var searchParameters = client._getSearchParams(filteredParams, '');
|
|
3799
|
+
|
|
3800
|
+
return client._jsonRequest({
|
|
3801
|
+
cache: client.cache,
|
|
3802
|
+
method: 'POST',
|
|
3803
|
+
url:
|
|
3804
|
+
'/1/indexes/' +
|
|
3805
|
+
encodeURIComponent(indexName) +
|
|
3806
|
+
'/facets/' +
|
|
3807
|
+
encodeURIComponent(facetName) +
|
|
3808
|
+
'/query',
|
|
3809
|
+
hostType: 'read',
|
|
3810
|
+
body: {params: searchParameters}
|
|
3811
|
+
});
|
|
3812
|
+
}));
|
|
3813
|
+
};
|
|
3814
|
+
|
|
3732
3815
|
/**
|
|
3733
3816
|
* Set the extra security tagFilters header
|
|
3734
3817
|
* @param {string|array} tags The list of tags defining the current security filters
|
|
@@ -4047,7 +4130,7 @@ module.exports =
|
|
|
4047
4130
|
|
|
4048
4131
|
|
|
4049
4132
|
|
|
4050
|
-
module.exports = '3.
|
|
4133
|
+
module.exports = '3.27.1';
|
|
4051
4134
|
|
|
4052
4135
|
|
|
4053
4136
|
/***/ })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! algoliasearch 3.
|
|
1
|
+
/*! algoliasearch 3.27.1 | © 2014, 2015 Algolia SAS | github.com/algolia/algoliasearch-client-js */
|
|
2
2
|
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.algoliasearch = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
3
3
|
(function (process){
|
|
4
4
|
/**
|
|
@@ -2278,7 +2278,6 @@ function AlgoliaSearchCore(applicationID, apiKey, opts) {
|
|
|
2278
2278
|
|
|
2279
2279
|
opts = opts || {};
|
|
2280
2280
|
|
|
2281
|
-
var protocol = opts.protocol || 'https:';
|
|
2282
2281
|
this._timeouts = opts.timeouts || {
|
|
2283
2282
|
connect: 1 * 1000, // 500ms connect is GPRS latency
|
|
2284
2283
|
read: 2 * 1000,
|
|
@@ -2290,13 +2289,14 @@ function AlgoliaSearchCore(applicationID, apiKey, opts) {
|
|
|
2290
2289
|
this._timeouts.connect = this._timeouts.read = this._timeouts.write = opts.timeout;
|
|
2291
2290
|
}
|
|
2292
2291
|
|
|
2292
|
+
var protocol = opts.protocol || 'https:';
|
|
2293
2293
|
// while we advocate for colon-at-the-end values: 'http:' for `opts.protocol`
|
|
2294
2294
|
// we also accept `http` and `https`. It's a common error.
|
|
2295
2295
|
if (!/:$/.test(protocol)) {
|
|
2296
2296
|
protocol = protocol + ':';
|
|
2297
2297
|
}
|
|
2298
2298
|
|
|
2299
|
-
if (
|
|
2299
|
+
if (protocol !== 'http:' && protocol !== 'https:') {
|
|
2300
2300
|
throw new errors.AlgoliaSearchError('protocol must be `http:` or `https:` (was `' + opts.protocol + '`)');
|
|
2301
2301
|
}
|
|
2302
2302
|
|
|
@@ -2308,7 +2308,8 @@ function AlgoliaSearchCore(applicationID, apiKey, opts) {
|
|
|
2308
2308
|
});
|
|
2309
2309
|
|
|
2310
2310
|
// no hosts given, compute defaults
|
|
2311
|
-
|
|
2311
|
+
var mainSuffix = (opts.dsn === false ? '' : '-dsn') + '.algolia.net';
|
|
2312
|
+
this.hosts.read = [this.applicationID + mainSuffix].concat(defaultHosts);
|
|
2312
2313
|
this.hosts.write = [this.applicationID + '.algolia.net'].concat(defaultHosts);
|
|
2313
2314
|
} else if (isArray(opts.hosts)) {
|
|
2314
2315
|
// when passing custom hosts, we need to have a different host index if the number
|
|
@@ -2822,6 +2823,70 @@ AlgoliaSearchCore.prototype.search = function(queries, opts, callback) {
|
|
|
2822
2823
|
});
|
|
2823
2824
|
};
|
|
2824
2825
|
|
|
2826
|
+
/**
|
|
2827
|
+
* Search for facet values
|
|
2828
|
+
* https://www.algolia.com/doc/rest-api/search#search-for-facet-values
|
|
2829
|
+
* This is the top-level API for SFFV.
|
|
2830
|
+
*
|
|
2831
|
+
* @param {object[]} queries An array of queries to run.
|
|
2832
|
+
* @param {string} queries[].indexName Index name, name of the index to search.
|
|
2833
|
+
* @param {object} queries[].params Query parameters.
|
|
2834
|
+
* @param {string} queries[].params.facetName Facet name, name of the attribute to search for values in.
|
|
2835
|
+
* Must be declared as a facet
|
|
2836
|
+
* @param {string} queries[].params.facetQuery Query for the facet search
|
|
2837
|
+
* @param {string} [queries[].params.*] Any search parameter of Algolia,
|
|
2838
|
+
* see https://www.algolia.com/doc/api-client/javascript/search#search-parameters
|
|
2839
|
+
* Pagination is not supported. The page and hitsPerPage parameters will be ignored.
|
|
2840
|
+
*/
|
|
2841
|
+
AlgoliaSearchCore.prototype.searchForFacetValues = function(queries) {
|
|
2842
|
+
var isArray = require(7);
|
|
2843
|
+
var map = require(25);
|
|
2844
|
+
|
|
2845
|
+
var usage = 'Usage: client.searchForFacetValues([{indexName, params: {facetName, facetQuery, ...params}}, ...queries])'; // eslint-disable-line max-len
|
|
2846
|
+
|
|
2847
|
+
if (!isArray(queries)) {
|
|
2848
|
+
throw new Error(usage);
|
|
2849
|
+
}
|
|
2850
|
+
|
|
2851
|
+
var client = this;
|
|
2852
|
+
|
|
2853
|
+
return client._promise.all(map(queries, function performQuery(query) {
|
|
2854
|
+
if (
|
|
2855
|
+
!query ||
|
|
2856
|
+
query.indexName === undefined ||
|
|
2857
|
+
query.params.facetName === undefined ||
|
|
2858
|
+
query.params.facetQuery === undefined
|
|
2859
|
+
) {
|
|
2860
|
+
throw new Error(usage);
|
|
2861
|
+
}
|
|
2862
|
+
|
|
2863
|
+
var clone = require(20);
|
|
2864
|
+
var omit = require(27);
|
|
2865
|
+
|
|
2866
|
+
var indexName = query.indexName;
|
|
2867
|
+
var params = query.params;
|
|
2868
|
+
|
|
2869
|
+
var facetName = params.facetName;
|
|
2870
|
+
var filteredParams = omit(clone(params), function(keyName) {
|
|
2871
|
+
return keyName === 'facetName';
|
|
2872
|
+
});
|
|
2873
|
+
var searchParameters = client._getSearchParams(filteredParams, '');
|
|
2874
|
+
|
|
2875
|
+
return client._jsonRequest({
|
|
2876
|
+
cache: client.cache,
|
|
2877
|
+
method: 'POST',
|
|
2878
|
+
url:
|
|
2879
|
+
'/1/indexes/' +
|
|
2880
|
+
encodeURIComponent(indexName) +
|
|
2881
|
+
'/facets/' +
|
|
2882
|
+
encodeURIComponent(facetName) +
|
|
2883
|
+
'/query',
|
|
2884
|
+
hostType: 'read',
|
|
2885
|
+
body: {params: searchParameters}
|
|
2886
|
+
});
|
|
2887
|
+
}));
|
|
2888
|
+
};
|
|
2889
|
+
|
|
2825
2890
|
/**
|
|
2826
2891
|
* Set the extra security tagFilters header
|
|
2827
2892
|
* @param {string|array} tags The list of tags defining the current security filters
|
|
@@ -3042,7 +3107,7 @@ function removeCredentials(headers) {
|
|
|
3042
3107
|
}
|
|
3043
3108
|
|
|
3044
3109
|
}).call(this,require(11))
|
|
3045
|
-
},{"1":1,"11":11,"14":14,"20":20,"23":23,"24":24,"25":25,"29":29,"4":4,"7":7}],14:[function(require,module,exports){
|
|
3110
|
+
},{"1":1,"11":11,"14":14,"20":20,"23":23,"24":24,"25":25,"27":27,"29":29,"4":4,"7":7}],14:[function(require,module,exports){
|
|
3046
3111
|
var buildSearchMethod = require(19);
|
|
3047
3112
|
var deprecate = require(21);
|
|
3048
3113
|
var deprecatedMessage = require(22);
|
|
@@ -3645,6 +3710,9 @@ module.exports = function createAlgoliasearch(AlgoliaSearch, uaSuffix) {
|
|
|
3645
3710
|
return new Promise(function resolveOnTimeout(resolve/* , reject*/) {
|
|
3646
3711
|
setTimeout(resolve, ms);
|
|
3647
3712
|
});
|
|
3713
|
+
},
|
|
3714
|
+
all: function all(promises) {
|
|
3715
|
+
return Promise.all(promises);
|
|
3648
3716
|
}
|
|
3649
3717
|
};
|
|
3650
3718
|
|
|
@@ -4165,7 +4233,7 @@ function cleanup() {
|
|
|
4165
4233
|
},{"1":1}],30:[function(require,module,exports){
|
|
4166
4234
|
'use strict';
|
|
4167
4235
|
|
|
4168
|
-
module.exports = '3.
|
|
4236
|
+
module.exports = '3.27.1';
|
|
4169
4237
|
|
|
4170
4238
|
},{}]},{},[15])(15)
|
|
4171
4239
|
});
|