algoliasearch-rails 1.11.12 → 1.11.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/README.md +6 -0
- data/VERSION +1 -1
- data/vendor/assets/javascripts/algolia/algoliasearch.js +108 -53
- data/vendor/assets/javascripts/algolia/algoliasearch.min.js +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9be5a5fb846cd1b9ed0d12c44095c61a835ce7a5
|
4
|
+
data.tar.gz: cedec1523035e705924bec9e8daa8b8f9a78ef21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54ec71dcde9a65f9eac7c3b682ec4ff226fe6637e00185a740e4b85adafb556fcebd636b31b1199e1c1cc6c8e72ba05e302c9ed744e7becbab7c8baf546ada55
|
7
|
+
data.tar.gz: d53d349f96bdf6b56c2998f649d4f8ecdae68cf354178b9d59eca05e3f9403c2f1caa1da8999bf9334dbbf5089a908f29fd6080bcbacc5679dae5e3bc6363984
|
data/ChangeLog
CHANGED
data/README.md
CHANGED
@@ -615,6 +615,12 @@ p hits
|
|
615
615
|
p hits.raw_answer # to get the original JSON raw answer
|
616
616
|
```
|
617
617
|
|
618
|
+
A `highlight_result` attribute is added to each ORM object:
|
619
|
+
|
620
|
+
```ruby
|
621
|
+
hits[0].highlight_result['first_name']['value']
|
622
|
+
```
|
623
|
+
|
618
624
|
If you want to retrieve the raw JSON answer from the API, without re-loading the objects from the database, you can use:
|
619
625
|
|
620
626
|
```ruby
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.11.
|
1
|
+
1.11.13
|
@@ -21,7 +21,7 @@
|
|
21
21
|
* THE SOFTWARE.
|
22
22
|
*/
|
23
23
|
|
24
|
-
var ALGOLIA_VERSION = '2.
|
24
|
+
var ALGOLIA_VERSION = '2.8.6';
|
25
25
|
|
26
26
|
/*
|
27
27
|
* Copyright (c) 2013 Algolia
|
@@ -61,7 +61,7 @@ var AlgoliaSearch = function(applicationID, apiKey, methodOrOptions, resolveDNS,
|
|
61
61
|
var self = this;
|
62
62
|
this.applicationID = applicationID;
|
63
63
|
this.apiKey = apiKey;
|
64
|
-
this.dsn =
|
64
|
+
this.dsn = true;
|
65
65
|
this.dsnHost = null;
|
66
66
|
this.hosts = [];
|
67
67
|
this.currentHostIndex = 0;
|
@@ -70,7 +70,7 @@ var AlgoliaSearch = function(applicationID, apiKey, methodOrOptions, resolveDNS,
|
|
70
70
|
this.jsonp = null;
|
71
71
|
|
72
72
|
var method;
|
73
|
-
var tld = '
|
73
|
+
var tld = 'net';
|
74
74
|
if (typeof methodOrOptions === 'string') { // Old initialization
|
75
75
|
method = methodOrOptions;
|
76
76
|
} else {
|
@@ -465,13 +465,7 @@ AlgoliaSearch.prototype = {
|
|
465
465
|
*/
|
466
466
|
sendQueriesBatch: function(callback, delay) {
|
467
467
|
var as = this;
|
468
|
-
var params = {requests: []
|
469
|
-
if (this.userToken) {
|
470
|
-
params['X-Algolia-UserToken'] = this.userToken;
|
471
|
-
}
|
472
|
-
if (this.tagFilters) {
|
473
|
-
params['X-Algolia-TagFilters'] = this.tagFilters;
|
474
|
-
}
|
468
|
+
var params = {requests: []};
|
475
469
|
for (var i = 0; i < as.batch.length; ++i) {
|
476
470
|
params.requests.push(as.batch[i]);
|
477
471
|
}
|
@@ -519,7 +513,8 @@ AlgoliaSearch.prototype = {
|
|
519
513
|
},
|
520
514
|
|
521
515
|
_sendQueriesBatch: function(params, callback) {
|
522
|
-
|
516
|
+
|
517
|
+
if (this.jsonp === null) {
|
523
518
|
var self = this;
|
524
519
|
this._jsonRequest({ cache: this.cache,
|
525
520
|
method: 'POST',
|
@@ -542,24 +537,24 @@ AlgoliaSearch.prototype = {
|
|
542
537
|
var q = '/1/indexes/' + encodeURIComponent(params.requests[i].indexName) + '?' + params.requests[i].params;
|
543
538
|
jsonpParams += i + '=' + encodeURIComponent(q) + '&';
|
544
539
|
}
|
540
|
+
var pObj = {params: jsonpParams};
|
545
541
|
this._jsonRequest({ cache: this.cache,
|
546
542
|
method: 'GET',
|
547
543
|
url: '/1/indexes/*',
|
548
|
-
|
544
|
+
body: pObj,
|
549
545
|
callback: callback });
|
550
546
|
} else {
|
551
547
|
this._jsonRequest({ cache: this.cache,
|
552
548
|
method: 'POST',
|
553
549
|
url: '/1/indexes/*/queries',
|
554
550
|
body: params,
|
555
|
-
|
551
|
+
callback: callback});
|
556
552
|
}
|
557
553
|
},
|
558
554
|
/*
|
559
555
|
* Wrapper that try all hosts to maximize the quality of service
|
560
556
|
*/
|
561
557
|
_jsonRequest: function(opts) {
|
562
|
-
var successiveRetryCount = 0;
|
563
558
|
var self = this;
|
564
559
|
var callback = opts.callback;
|
565
560
|
var cache = null;
|
@@ -577,10 +572,11 @@ AlgoliaSearch.prototype = {
|
|
577
572
|
}
|
578
573
|
}
|
579
574
|
|
575
|
+
opts.successiveRetryCount = 0;
|
580
576
|
var impl = function() {
|
581
|
-
if (successiveRetryCount >= self.hosts.length) {
|
577
|
+
if (opts.successiveRetryCount >= self.hosts.length) {
|
582
578
|
if (!self._isUndefined(callback)) {
|
583
|
-
successiveRetryCount = 0;
|
579
|
+
opts.successiveRetryCount = 0;
|
584
580
|
callback(false, { message: 'Cannot connect the Algolia\'s Search API. Please send an email to support@algolia.com to report the issue.' });
|
585
581
|
}
|
586
582
|
return;
|
@@ -594,10 +590,10 @@ AlgoliaSearch.prototype = {
|
|
594
590
|
}
|
595
591
|
if (!success && retry) {
|
596
592
|
self.currentHostIndex = ++self.currentHostIndex % self.hosts.length;
|
597
|
-
successiveRetryCount += 1;
|
593
|
+
opts.successiveRetryCount += 1;
|
598
594
|
impl();
|
599
595
|
} else {
|
600
|
-
successiveRetryCount = 0;
|
596
|
+
opts.successiveRetryCount = 0;
|
601
597
|
if (!self._isUndefined(callback)) {
|
602
598
|
callback(success, body);
|
603
599
|
}
|
@@ -646,16 +642,20 @@ AlgoliaSearch.prototype = {
|
|
646
642
|
};
|
647
643
|
|
648
644
|
script.type = 'text/javascript';
|
649
|
-
script.src = url + '?callback=' + cb + '
|
645
|
+
script.src = url + '?callback=' + cb + '&X-Algolia-Application-Id=' + this.applicationID + '&X-Algolia-API-Key=' + this.apiKey;
|
650
646
|
|
651
|
-
if (
|
652
|
-
script.src += '&X-Algolia-TagFilters=' + encodeURIComponent(
|
647
|
+
if (this.tagFilters) {
|
648
|
+
script.src += '&X-Algolia-TagFilters=' + encodeURIComponent(this.tagFilters);
|
653
649
|
}
|
654
650
|
|
655
|
-
if (
|
656
|
-
script.src += '&X-Algolia-UserToken=' + encodeURIComponent(
|
651
|
+
if (this.userToken) {
|
652
|
+
script.src += '&X-Algolia-UserToken=' + encodeURIComponent(this.userToken);
|
653
|
+
}
|
654
|
+
for (var i = 0; i < this.extraHeaders.length; ++i) {
|
655
|
+
script.src += '&' + this.extraHeaders[i].key + '=' + this.extraHeaders[i].value;
|
657
656
|
}
|
658
657
|
|
658
|
+
|
659
659
|
if (opts.body && opts.body.params) {
|
660
660
|
script.src += '&' + opts.body.params;
|
661
661
|
}
|
@@ -719,19 +719,24 @@ AlgoliaSearch.prototype = {
|
|
719
719
|
if (!this._isUndefined(opts.body)) {
|
720
720
|
body = JSON.stringify(opts.body);
|
721
721
|
}
|
722
|
-
|
722
|
+
|
723
|
+
url += ((url.indexOf('?') === -1) ? '?' : '&') + 'X-Algolia-API-Key=' + this.apiKey;
|
724
|
+
url += '&X-Algolia-Application-Id=' + this.applicationID;
|
725
|
+
if (this.userToken) {
|
726
|
+
url += '&X-Algolia-UserToken=' + encodeURIComponent(this.userToken);
|
727
|
+
}
|
728
|
+
if (this.tagFilters) {
|
729
|
+
url += '&X-Algolia-TagFilters=' + encodeURIComponent(this.tagFilters);
|
730
|
+
}
|
731
|
+
for (var i = 0; i < this.extraHeaders.length; ++i) {
|
732
|
+
url += '&' + this.extraHeaders[i].key + '=' + this.extraHeaders[i].value;
|
733
|
+
}
|
723
734
|
if ('withCredentials' in xmlHttp) {
|
724
|
-
xmlHttp.open(opts.method, url
|
725
|
-
|
726
|
-
xmlHttp.setRequestHeader('X-Algolia-API-Key', this.apiKey);
|
727
|
-
xmlHttp.setRequestHeader('X-Algolia-Application-Id', this.applicationID);
|
728
|
-
}
|
729
|
-
xmlHttp.timeout = this.requestTimeoutInMs;
|
730
|
-
for (var i = 0; i < this.extraHeaders.length; ++i) {
|
731
|
-
xmlHttp.setRequestHeader(this.extraHeaders[i].key, this.extraHeaders[i].value);
|
732
|
-
}
|
735
|
+
xmlHttp.open(opts.method, url, true);
|
736
|
+
xmlHttp.timeout = this.requestTimeoutInMs * (opts.successiveRetryCount + 1);
|
733
737
|
if (body !== null) {
|
734
|
-
|
738
|
+
/* This content type is specified to follow CORS 'simple header' directive */
|
739
|
+
xmlHttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
|
735
740
|
}
|
736
741
|
} else if (typeof XDomainRequest !== 'undefined') {
|
737
742
|
// Handle IE8/IE9
|
@@ -756,7 +761,7 @@ AlgoliaSearch.prototype = {
|
|
756
761
|
clearTimeout(ontimeout);
|
757
762
|
ontimeout = null;
|
758
763
|
|
759
|
-
}, this.requestTimeoutInMs);
|
764
|
+
}, this.requestTimeoutInMs * (opts.successiveRetryCount + 1));
|
760
765
|
|
761
766
|
xmlHttp.onload = function(event) {
|
762
767
|
clearTimeout(ontimeout);
|
@@ -900,9 +905,17 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
900
905
|
params += attributes[i];
|
901
906
|
}
|
902
907
|
}
|
903
|
-
this.as.
|
904
|
-
|
905
|
-
|
908
|
+
if (this.as.jsonp === null) {
|
909
|
+
this.as._jsonRequest({ method: 'GET',
|
910
|
+
url: '/1/indexes/' + encodeURIComponent(indexObj.indexName) + '/' + encodeURIComponent(objectID) + params,
|
911
|
+
callback: callback });
|
912
|
+
} else {
|
913
|
+
var pObj = {params: params};
|
914
|
+
this.as._jsonRequest({ method: 'GET',
|
915
|
+
url: '/1/indexes/' + encodeURIComponent(indexObj.indexName) + '/' + encodeURIComponent(objectID),
|
916
|
+
callback: callback,
|
917
|
+
body: pObj});
|
918
|
+
}
|
906
919
|
},
|
907
920
|
|
908
921
|
/*
|
@@ -1327,13 +1340,7 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
1327
1340
|
/// Internal methods only after this line
|
1328
1341
|
///
|
1329
1342
|
_search: function(params, callback) {
|
1330
|
-
var pObj = {params: params
|
1331
|
-
if (this.as.tagFilters) {
|
1332
|
-
pObj['X-Algolia-TagFilters'] = this.as.tagFilters;
|
1333
|
-
}
|
1334
|
-
if (this.as.userToken) {
|
1335
|
-
pObj['X-Algolia-UserToken'] = this.as.userToken;
|
1336
|
-
}
|
1343
|
+
var pObj = {params: params};
|
1337
1344
|
if (this.as.jsonp === null) {
|
1338
1345
|
var self = this;
|
1339
1346
|
this.as._jsonRequest({ cache: this.cache,
|
@@ -1418,14 +1425,15 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
1418
1425
|
* Algolia Search Helper providing faceting and disjunctive faceting
|
1419
1426
|
* @param {AlgoliaSearch} client an AlgoliaSearch client
|
1420
1427
|
* @param {string} index the index name to query
|
1421
|
-
* @param {hash} options an associative array defining the hitsPerPage, list of facets
|
1428
|
+
* @param {hash} options an associative array defining the hitsPerPage, list of facets, the list of disjunctive facets and the default facet filters
|
1422
1429
|
*/
|
1423
1430
|
window.AlgoliaSearchHelper = function(client, index, options) {
|
1424
1431
|
/// Default options
|
1425
1432
|
var defaults = {
|
1426
1433
|
facets: [], // list of facets to compute
|
1427
1434
|
disjunctiveFacets: [], // list of disjunctive facets to compute
|
1428
|
-
hitsPerPage: 20
|
1435
|
+
hitsPerPage: 20, // number of hits per page
|
1436
|
+
defaultFacetFilters: [] // the default list of facetFilters
|
1429
1437
|
};
|
1430
1438
|
|
1431
1439
|
this.init(client, index, extend({}, defaults, options));
|
@@ -1647,8 +1655,18 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
1647
1655
|
_search: function() {
|
1648
1656
|
this.client.startQueriesBatch();
|
1649
1657
|
this.client.addQueryInBatch(this.index, this.q, this._getHitsSearchParams());
|
1658
|
+
var disjunctiveFacets = [];
|
1659
|
+
var unusedDisjunctiveFacets = {};
|
1650
1660
|
for (var i = 0; i < this.options.disjunctiveFacets.length; ++i) {
|
1651
|
-
|
1661
|
+
var facet = this.options.disjunctiveFacets[i];
|
1662
|
+
if (this._hasDisjunctiveRefinements(facet)) {
|
1663
|
+
disjunctiveFacets.push(facet);
|
1664
|
+
} else {
|
1665
|
+
unusedDisjunctiveFacets[facet] = true;
|
1666
|
+
}
|
1667
|
+
}
|
1668
|
+
for (var i = 0; i < disjunctiveFacets.length; ++i) {
|
1669
|
+
this.client.addQueryInBatch(this.index, this.q, this._getDisjunctiveFacetSearchParams(disjunctiveFacets[i]));
|
1652
1670
|
}
|
1653
1671
|
for (var i = 0; i < this.extraQueries.length; ++i) {
|
1654
1672
|
this.client.addQueryInBatch(this.extraQueries[i].index, this.extraQueries[i].query, this.extraQueries[i].params);
|
@@ -1660,9 +1678,19 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
1660
1678
|
return;
|
1661
1679
|
}
|
1662
1680
|
var aggregatedAnswer = content.results[0];
|
1663
|
-
aggregatedAnswer.disjunctiveFacets = {};
|
1664
|
-
aggregatedAnswer.facetStats = {};
|
1665
|
-
for (var
|
1681
|
+
aggregatedAnswer.disjunctiveFacets = aggregatedAnswer.disjunctiveFacets || {};
|
1682
|
+
aggregatedAnswer.facetStats = aggregatedAnswer.facetStats || {};
|
1683
|
+
for (var facet in unusedDisjunctiveFacets) {
|
1684
|
+
if (aggregatedAnswer.facets[facet] && !aggregatedAnswer.disjunctiveFacets[facet]) {
|
1685
|
+
aggregatedAnswer.disjunctiveFacets[facet] = aggregatedAnswer.facets[facet];
|
1686
|
+
try {
|
1687
|
+
delete aggregatedAnswer.facets[facet];
|
1688
|
+
} catch (e) {
|
1689
|
+
aggregatedAnswer.facets[facet] = undefined; // IE compat
|
1690
|
+
}
|
1691
|
+
}
|
1692
|
+
}
|
1693
|
+
for (var i = 0; i < disjunctiveFacets.length; ++i) {
|
1666
1694
|
for (var facet in content.results[i + 1].facets) {
|
1667
1695
|
aggregatedAnswer.disjunctiveFacets[facet] = content.results[i + 1].facets[facet];
|
1668
1696
|
if (self.disjunctiveRefinements[facet]) {
|
@@ -1682,7 +1710,7 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
1682
1710
|
} else {
|
1683
1711
|
var c = { results: [ aggregatedAnswer ] };
|
1684
1712
|
for (var i = 0; i < self.extraQueries.length; ++i) {
|
1685
|
-
c.results.push(content.results[1 +
|
1713
|
+
c.results.push(content.results[1 + disjunctiveFacets.length + i]);
|
1686
1714
|
}
|
1687
1715
|
self.searchCallback(true, c);
|
1688
1716
|
}
|
@@ -1694,10 +1722,20 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
1694
1722
|
* @return {hash}
|
1695
1723
|
*/
|
1696
1724
|
_getHitsSearchParams: function() {
|
1725
|
+
var facets = [];
|
1726
|
+
for (var i = 0; i < this.options.facets.length; ++i) {
|
1727
|
+
facets.push(this.options.facets[i]);
|
1728
|
+
}
|
1729
|
+
for (var i = 0; i < this.options.disjunctiveFacets.length; ++i) {
|
1730
|
+
var facet = this.options.disjunctiveFacets[i];
|
1731
|
+
if (!this._hasDisjunctiveRefinements(facet)) {
|
1732
|
+
facets.push(facet);
|
1733
|
+
}
|
1734
|
+
}
|
1697
1735
|
return extend({}, {
|
1698
1736
|
hitsPerPage: this.options.hitsPerPage,
|
1699
1737
|
page: this.page,
|
1700
|
-
facets:
|
1738
|
+
facets: facets,
|
1701
1739
|
facetFilters: this._getFacetFilters()
|
1702
1740
|
}, this.searchParams);
|
1703
1741
|
},
|
@@ -1719,6 +1757,18 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
1719
1757
|
});
|
1720
1758
|
},
|
1721
1759
|
|
1760
|
+
/**
|
1761
|
+
* Test if there are some disjunctive refinements on the facet
|
1762
|
+
*/
|
1763
|
+
_hasDisjunctiveRefinements: function(facet) {
|
1764
|
+
for (var value in this.disjunctiveRefinements[facet]) {
|
1765
|
+
if (this.disjunctiveRefinements[facet][value]) {
|
1766
|
+
return true;
|
1767
|
+
}
|
1768
|
+
}
|
1769
|
+
return false;
|
1770
|
+
},
|
1771
|
+
|
1722
1772
|
/**
|
1723
1773
|
* Build facetFilters parameter based on current refinements
|
1724
1774
|
* @param {string} facet if set, the current disjunctive facet
|
@@ -1726,6 +1776,11 @@ AlgoliaSearch.prototype.Index.prototype = {
|
|
1726
1776
|
*/
|
1727
1777
|
_getFacetFilters: function(facet) {
|
1728
1778
|
var facetFilters = [];
|
1779
|
+
if (this.options.defaultFacetFilters) {
|
1780
|
+
for (var i = 0; i < this.options.defaultFacetFilters.length; ++i) {
|
1781
|
+
facetFilters.push(this.options.defaultFacetFilters[i]);
|
1782
|
+
}
|
1783
|
+
}
|
1729
1784
|
for (var refinement in this.refinements) {
|
1730
1785
|
if (this.refinements[refinement]) {
|
1731
1786
|
facetFilters.push(refinement);
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/*!
|
2
|
-
* algoliasearch 2.
|
2
|
+
* algoliasearch 2.8.6
|
3
3
|
* https://github.com/algolia/algoliasearch-client-js
|
4
4
|
* Copyright 2014 Algolia SAS; Licensed MIT
|
5
5
|
*/
|
6
6
|
|
7
|
-
function AlgoliaExplainResults(a,b,c){function d(a,b){var c=[];if("object"==typeof a&&"matchedWords"in a&&"value"in a){for(var e=!1,f=0;f<a.matchedWords.length;++f){var g=a.matchedWords[f];g in b||(b[g]=1,e=!0)}e&&c.push(a.value)}else if("[object Array]"===Object.prototype.toString.call(a))for(var h=0;h<a.length;++h){var i=d(a[h],b);c=c.concat(i)}else if("object"==typeof a)for(var j in a)a.hasOwnProperty(j)&&(c=c.concat(d(a[j],b)));return c}function e(a,b,c){var f=a._highlightResult||a;if(-1===c.indexOf("."))return c in f?d(f[c],b):[];for(var g=c.split("."),h=f,i=0;i<g.length;++i){if("[object Array]"===Object.prototype.toString.call(h)){for(var j=[],k=0;k<h.length;++k)j=j.concat(e(h[k],b,g.slice(i).join(".")));return j}if(!(g[i]in h))return[];h=h[g[i]]}return d(h,b)}var f={},g={},h=e(a,g,b);if(f.title=h.length>0?h[0]:"",f.subtitles=[],"undefined"!=typeof c)for(var i=0;i<c.length;++i)for(var j=e(a,g,c[i]),k=0;k<j.length;++k)f.subtitles.push({attr:c[i],value:j[k]});return f}var ALGOLIA_VERSION="2.7.5",AlgoliaSearch=function(a,b,c,d,e){this.applicationID=a,this.apiKey=b,this.dsn=!1,this.dsnHost=null,this.hosts=[],this.currentHostIndex=0,this.requestTimeoutInMs=2e3,this.extraHeaders=[],this.jsonp=null;var f,g="io";if("string"==typeof c)f=c;else{var h=c||{};this._isUndefined(h.method)||(f=h.method),this._isUndefined(h.tld)||(g=h.tld),this._isUndefined(h.dsn)||(this.dsn=h.dsn),this._isUndefined(h.hosts)||(e=h.hosts),this._isUndefined(h.dsnHost)||(this.dsnHost=h.dsnHost),this._isUndefined(h.requestTimeoutInMs)||(this.requestTimeoutInMs=+h.requestTimeoutInMs),this._isUndefined(h.jsonp)||(this.jsonp=h.jsonp)}this._isUndefined(e)&&(e=[this.applicationID+"-1.algolia."+g,this.applicationID+"-2.algolia."+g,this.applicationID+"-3.algolia."+g]),this.host_protocol="http://",this._isUndefined(f)||null===f?this.host_protocol=("https:"==document.location.protocol?"https":"http")+"://":("https"===f||"HTTPS"===f)&&(this.host_protocol="https://");for(var i=0;i<e.length;++i)Math.random()>.5&&this.hosts.reverse(),this.hosts.push(this.host_protocol+e[i]);Math.random()>.5&&this.hosts.reverse(),(this.dsn||null!=this.dsnHost)&&this.hosts.unshift(this.dsnHost?this.host_protocol+this.dsnHost:this.host_protocol+this.applicationID+"-dsn.algolia."+g)};AlgoliaSearch.prototype={deleteIndex:function(a,b){this._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(a),callback:b})},moveIndex:function(a,b,c){var d={operation:"move",destination:b};this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,callback:c})},copyIndex:function(a,b,c){var d={operation:"copy",destination:b};this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,callback:c})},getLogs:function(a,b,c){this._isUndefined(b)&&(b=0),this._isUndefined(c)&&(c=10),this._jsonRequest({method:"GET",url:"/1/logs?offset="+b+"&length="+c,callback:a})},listIndexes:function(a,b){var c=b?"?page="+b:"";this._jsonRequest({method:"GET",url:"/1/indexes"+c,callback:a})},initIndex:function(a){return new this.Index(this,a)},listUserKeys:function(a){this._jsonRequest({method:"GET",url:"/1/keys",callback:a})},getUserKeyACL:function(a,b){this._jsonRequest({method:"GET",url:"/1/keys/"+a,callback:b})},deleteUserKey:function(a,b){this._jsonRequest({method:"DELETE",url:"/1/keys/"+a,callback:b})},addUserKey:function(a,b){var c={};c.acl=a,this._jsonRequest({method:"POST",url:"/1/keys",body:c,callback:b})},addUserKeyWithValidity:function(a,b,c,d,e){var f=this,g={};g.acl=a,g.validity=b,g.maxQueriesPerIPPerHour=c,g.maxHitsPerQuery=d,this._jsonRequest({method:"POST",url:"/1/indexes/"+f.indexName+"/keys",body:g,callback:e})},setSecurityTags:function(a){if("[object Array]"===Object.prototype.toString.call(a)){for(var b=[],c=0;c<a.length;++c)if("[object Array]"===Object.prototype.toString.call(a[c])){for(var d=[],e=0;e<a[c].length;++e)d.push(a[c][e]);b.push("("+d.join(",")+")")}else b.push(a[c]);a=b.join(",")}this.tagFilters=a},setUserToken:function(a){this.userToken=a},startQueriesBatch:function(){this.batch=[]},addQueryInBatch:function(a,b,c){var d="query="+encodeURIComponent(b);this._isUndefined(c)||null===c||(d=this._getSearchParams(c,d)),this.batch.push({indexName:a,params:d})},clearCache:function(){this.cache={}},sendQueriesBatch:function(a,b){var c=this,d={requests:[],apiKey:this.apiKey,appID:this.applicationID};this.userToken&&(d["X-Algolia-UserToken"]=this.userToken),this.tagFilters&&(d["X-Algolia-TagFilters"]=this.tagFilters);for(var e=0;e<c.batch.length;++e)d.requests.push(c.batch[e]);if(window.clearTimeout(c.onDelayTrigger),!this._isUndefined(b)&&null!==b&&b>0){var f=window.setTimeout(function(){c._sendQueriesBatch(d,a)},b);c.onDelayTrigger=f}else this._sendQueriesBatch(d,a)},setRequestTimeout:function(a){a&&(this.requestTimeoutInMs=parseInt(a,10))},Index:function(a,b){this.indexName=b,this.as=a,this.typeAheadArgs=null,this.typeAheadValueOption=null},setExtraHeader:function(a,b){this.extraHeaders.push({key:a,value:b})},_sendQueriesBatch:function(a,b){if(null===this.jsonp){var c=this;this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:a,callback:function(d,e){d?(c.jsonp=!1,b&&b(d,e)):(c.jsonp=!0,c._sendQueriesBatch(a,b))}})}else if(this.jsonp){for(var d="",e=0;e<a.requests.length;++e){var f="/1/indexes/"+encodeURIComponent(a.requests[e].indexName)+"?"+a.requests[e].params;d+=e+"="+encodeURIComponent(f)+"&"}this._jsonRequest({cache:this.cache,method:"GET",url:"/1/indexes/*",body:{params:d},callback:b})}else this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:a,callback:b})},_jsonRequest:function(a){var b=0,c=this,d=a.callback,e=null,f=a.url;if(this._isUndefined(a.body)||(f=a.url+"_body_"+JSON.stringify(a.body)),!this._isUndefined(a.cache)&&(e=a.cache,!this._isUndefined(e[f])))return void(this._isUndefined(d)||setTimeout(function(){d(!0,e[f])},1));var g=function(){return b>=c.hosts.length?void(c._isUndefined(d)||(b=0,d(!1,{message:"Cannot connect the Algolia's Search API. Please send an email to support@algolia.com to report the issue."}))):(a.callback=function(h,i,j,k){i||c._isUndefined(k)||window.console&&console.log("Error: "+k.message),i&&!c._isUndefined(a.cache)&&(e[f]=k),!i&&h?(c.currentHostIndex=++c.currentHostIndex%c.hosts.length,b+=1,g()):(b=0,c._isUndefined(d)||d(i,k))},a.hostname=c.hosts[c.currentHostIndex],void c._jsonRequestByHost(a))};g()},_jsonRequestByHost:function(a){var b=a.hostname+a.url;this.jsonp?this._makeJsonpRequestByHost(b,a):this._makeXmlHttpRequestByHost(b,a)},_makeJsonpRequestByHost:function(a,b){if("GET"!==b.method)return void b.callback(!0,!1,null,{message:"Method "+b.method+" "+a+" is not supported by JSONP."});this.jsonpCounter=this.jsonpCounter||0,this.jsonpCounter+=1;var c=document.getElementsByTagName("head")[0],d=document.createElement("script"),e="algoliaJSONP_"+this.jsonpCounter,f=!1,g=null;window[e]=function(a){b.callback(!1,!0,null,a);try{delete window[e]}catch(c){window[e]=void 0}},d.type="text/javascript",d.src=a+"?callback="+e+","+this.applicationID+","+this.apiKey,b.body["X-Algolia-TagFilters"]&&(d.src+="&X-Algolia-TagFilters="+encodeURIComponent(b.body["X-Algolia-TagFilters"])),b.body["X-Algolia-UserToken"]&&(d.src+="&X-Algolia-UserToken="+encodeURIComponent(b.body["X-Algolia-UserToken"])),b.body&&b.body.params&&(d.src+="&"+b.body.params),g=setTimeout(function(){d.onload=d.onreadystatechange=d.onerror=null,window[e]=function(){try{delete window[e]}catch(a){window[e]=void 0}},b.callback(!0,!1,null,{message:"Timeout - Failed to load JSONP script."}),c.removeChild(d),clearTimeout(g),g=null},this.requestTimeoutInMs),d.onload=d.onreadystatechange=function(){if(clearTimeout(g),g=null,!(f||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState)){if(f=!0,"undefined"==typeof window[e+"_loaded"]){b.callback(!0,!1,null,{message:"Failed to load JSONP script."});try{delete window[e]}catch(a){window[e]=void 0}}else try{delete window[e+"_loaded"]}catch(a){window[e+"_loaded"]=void 0}d.onload=d.onreadystatechange=null,c.removeChild(d)}},d.onerror=function(){clearTimeout(g),g=null,b.callback(!0,!1,null,{message:"Failed to load JSONP script."}),c.removeChild(d);try{delete window[e]}catch(a){window[e]=void 0}},c.appendChild(d)},_makeXmlHttpRequestByHost:function(a,b){var c=this,d=window.XMLHttpRequest?new XMLHttpRequest:{},e=null,f=null;if(this._isUndefined(b.body)||(e=JSON.stringify(b.body)),"withCredentials"in d){d.open(b.method,a,!0),(this._isUndefined(b.removeCustomHTTPHeaders)||!b.removeCustomHTTPHeaders)&&(d.setRequestHeader("X-Algolia-API-Key",this.apiKey),d.setRequestHeader("X-Algolia-Application-Id",this.applicationID)),d.timeout=this.requestTimeoutInMs;for(var g=0;g<this.extraHeaders.length;++g)d.setRequestHeader(this.extraHeaders[g].key,this.extraHeaders[g].value);null!==e&&d.setRequestHeader("Content-type","application/json")}else{if("undefined"==typeof XDomainRequest)return void b.callback(!1,!1,null,{message:"CORS not supported"});d=new XDomainRequest,d.open(b.method,a)}f=setTimeout(function(){return d.abort(),d.aborted===!0?void stopLoadAnimation():(b.callback(!0,!1,null,{message:"Timeout - Could not connect to endpoint "+a}),clearTimeout(f),void(f=null))},this.requestTimeoutInMs),d.onload=function(a){if(clearTimeout(f),f=null,c._isUndefined(a)||null===a.target)b.callback(!1,!0,a,JSON.parse(d.responseText));else{var e=0===a.target.status||503===a.target.status,g=!1,h=null;"undefined"!=typeof XDomainRequest?(h=a.target.responseText,g=h&&h.length>0):(h=a.target.response,g=200===a.target.status||201===a.target.status),b.callback(e,g,a.target,h?JSON.parse(h):null)}},d.ontimeout=function(){},d.onerror=function(a){clearTimeout(f),f=null,b.callback(!0,!1,null,{message:"Could not connect to host",error:a})},d.send(e)},_getSearchParams:function(a,b){if(this._isUndefined(a)||null===a)return b;for(var c in a)null!==c&&a.hasOwnProperty(c)&&(b+=0===b.length?"?":"&",b+=c+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[c])?JSON.stringify(a[c]):a[c]));return b},_isUndefined:function(a){return void 0===a},applicationID:null,apiKey:null,tagFilters:null,userToken:null,hosts:[],cache:{},extraHeaders:[]},AlgoliaSearch.prototype.Index.prototype={clearCache:function(){this.cache={}},addObject:function(a,b,c){var d=this;this.as._jsonRequest(this.as._isUndefined(c)?{method:"POST",url:"/1/indexes/"+encodeURIComponent(d.indexName),body:a,callback:b}:{method:"PUT",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(c),body:a,callback:b})},addObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"addObject",body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},getObject:function(a,b,c){var d=this,e="";if(!this.as._isUndefined(c)){e="?attributes=";for(var f=0;f<c.length;++f)0!==f&&(e+=","),e+=c[f]}this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(a)+e,callback:b})},partialUpdateObject:function(a,b){var c=this;this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a.objectID)+"/partial",body:a,callback:b})},partialUpdateObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"partialUpdateObject",objectID:a[e].objectID,body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},saveObject:function(a,b){var c=this;this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a.objectID),body:a,callback:b})},saveObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"updateObject",objectID:a[e].objectID,body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},deleteObject:function(a,b){if(null===a||0===a.length)return void b(!1,{message:"empty objectID"});var c=this;this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a),callback:b})},search:function(a,b,c,d){var e=this,f="query="+encodeURIComponent(a);if(this.as._isUndefined(c)||null===c||(f=this.as._getSearchParams(c,f)),window.clearTimeout(e.onDelayTrigger),!this.as._isUndefined(d)&&null!==d&&d>0){var g=window.setTimeout(function(){e._search(f,b)},d);e.onDelayTrigger=g}else this._search(f,b)},browse:function(a,b,c){var d=this,e="?page="+a;this.as._isUndefined(c)||(e+="&hitsPerPage="+c),this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/browse"+e,callback:b})},ttAdapter:function(a){var b=this;return function(c,d){b.search(c,function(a,b){a&&d(b.hits)},a)}},waitTask:function(a,b){var c=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/task/"+a,callback:function(d,e){d?"published"===e.status?b(!0,e):setTimeout(function(){c.waitTask(a,b)},100):b(!1,e)}})},clearIndex:function(a){var b=this;this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/clear",callback:a})},getSettings:function(a){var b=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/settings",callback:a})},setSettings:function(a,b){var c=this;this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/settings",body:a,callback:b})},listUserKeys:function(a){var b=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/keys",callback:a})},getUserKeyACL:function(a,b){var c=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys/"+a,callback:b})},deleteUserKey:function(a,b){var c=this;this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys/"+a,callback:b})},addUserKey:function(a,b){var c=this,d={};d.acl=a,this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys",body:d,callback:b})},addUserKeyWithValidity:function(a,b,c,d,e){var f=this,g={};g.acl=a,g.validity=b,g.maxQueriesPerIPPerHour=c,g.maxHitsPerQuery=d,this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(f.indexName)+"/keys",body:g,callback:e})},_search:function(a,b){var c={params:a,apiKey:this.as.apiKey,appID:this.as.applicationID};if(this.as.tagFilters&&(c["X-Algolia-TagFilters"]=this.as.tagFilters),this.as.userToken&&(c["X-Algolia-UserToken"]=this.as.userToken),null===this.as.jsonp){var d=this;this.as._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:c,callback:function(c,e){c?(d.as.jsonp=!1,b&&b(c,e)):(d.as.jsonp=!0,d._search(a,b))}})}else this.as._jsonRequest(this.as.jsonp?{cache:this.cache,method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName),body:c,callback:b}:{cache:this.cache,method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:c,callback:b})},as:null,indexName:null,cache:{},typeAheadArgs:null,typeAheadValueOption:null,emptyConstructor:function(){}},function(){var a=function(a){a=a||{};for(var b=1;b<arguments.length;b++)if(arguments[b])for(var c in arguments[b])arguments[b].hasOwnProperty(c)&&(a[c]=arguments[b][c]);return a};window.AlgoliaSearchHelper=function(b,c,d){var e={facets:[],disjunctiveFacets:[],hitsPerPage:20};this.init(b,c,a({},e,d))},AlgoliaSearchHelper.prototype={init:function(a,b,c){this.client=a,this.index=b,this.options=c,this.page=0,this.refinements={},this.disjunctiveRefinements={},this.extraQueries=[]},search:function(a,b,c){this.q=a,this.searchCallback=b,this.searchParams=c||{},this.page=this.page||0,this.refinements=this.refinements||{},this.disjunctiveRefinements=this.disjunctiveRefinements||{},this._search()},clearRefinements:function(){this.disjunctiveRefinements={},this.refinements={}},addDisjunctiveRefine:function(a,b){this.disjunctiveRefinements=this.disjunctiveRefinements||{},this.disjunctiveRefinements[a]=this.disjunctiveRefinements[a]||{},this.disjunctiveRefinements[a][b]=!0},removeDisjunctiveRefine:function(a,b){this.disjunctiveRefinements=this.disjunctiveRefinements||{},this.disjunctiveRefinements[a]=this.disjunctiveRefinements[a]||{};try{delete this.disjunctiveRefinements[a][b]}catch(c){this.disjunctiveRefinements[a][b]=void 0}},addRefine:function(a,b){var c=a+":"+b;this.refinements=this.refinements||{},this.refinements[c]=!0},removeRefine:function(a,b){var c=a+":"+b;this.refinements=this.refinements||{},this.refinements[c]=!1},toggleRefine:function(a,b){for(var c=0;c<this.options.facets.length;++c)if(this.options.facets[c]==a){var d=a+":"+b;return this.refinements[d]=!this.refinements[d],this.page=0,this._search(),!0}this.disjunctiveRefinements[a]=this.disjunctiveRefinements[a]||{};for(var e=0;e<this.options.disjunctiveFacets.length;++e)if(this.options.disjunctiveFacets[e]==a)return this.disjunctiveRefinements[a][b]=!this.disjunctiveRefinements[a][b],this.page=0,this._search(),!0;return!1},isRefined:function(a,b){var c=a+":"+b;return this.refinements[c]?!0:this.disjunctiveRefinements[a]&&this.disjunctiveRefinements[a][b]?!0:!1},nextPage:function(){this._gotoPage(this.page+1)},previousPage:function(){this.page>0&&this._gotoPage(this.page-1)},gotoPage:function(a){this._gotoPage(a)},setPage:function(a){this.page=a},setIndex:function(a){this.index=a},getIndex:function(){return this.index},clearExtraQueries:function(){this.extraQueries=[]},addExtraQuery:function(a,b,c){this.extraQueries.push({index:a,query:b,params:c||{}})},_gotoPage:function(a){this.page=a,this._search()},_search:function(){this.client.startQueriesBatch(),this.client.addQueryInBatch(this.index,this.q,this._getHitsSearchParams());for(var a=0;a<this.options.disjunctiveFacets.length;++a)this.client.addQueryInBatch(this.index,this.q,this._getDisjunctiveFacetSearchParams(this.options.disjunctiveFacets[a]));for(var a=0;a<this.extraQueries.length;++a)this.client.addQueryInBatch(this.extraQueries[a].index,this.extraQueries[a].query,this.extraQueries[a].params);var b=this;this.client.sendQueriesBatch(function(a,c){if(!a)return void b.searchCallback(!1,c);var d=c.results[0];d.disjunctiveFacets={},d.facetStats={};for(var e=0;e<b.options.disjunctiveFacets.length;++e){for(var f in c.results[e+1].facets)if(d.disjunctiveFacets[f]=c.results[e+1].facets[f],b.disjunctiveRefinements[f])for(var g in b.disjunctiveRefinements[f])!d.disjunctiveFacets[f][g]&&b.disjunctiveRefinements[f][g]&&(d.disjunctiveFacets[f][g]=0);for(var h in c.results[e+1].facets_stats)d.facetStats[h]=c.results[e+1].facets_stats[h]}if(0===b.extraQueries.length)b.searchCallback(!0,d);else{for(var i={results:[d]},e=0;e<b.extraQueries.length;++e)i.results.push(c.results[1+b.options.disjunctiveFacets.length+e]);b.searchCallback(!0,i)}})},_getHitsSearchParams:function(){return a({},{hitsPerPage:this.options.hitsPerPage,page:this.page,facets:this.options.facets,facetFilters:this._getFacetFilters()},this.searchParams)},_getDisjunctiveFacetSearchParams:function(b){return a({},this.searchParams,{hitsPerPage:1,page:0,attributesToRetrieve:[],attributesToHighlight:[],attributesToSnippet:[],facets:b,facetFilters:this._getFacetFilters(b)})},_getFacetFilters:function(a){var b=[];for(var c in this.refinements)this.refinements[c]&&b.push(c);for(var d in this.disjunctiveRefinements)if(d!=a){var e=[];for(var f in this.disjunctiveRefinements[d])this.disjunctiveRefinements[d][f]&&e.push(d+":"+f);e.length>0&&b.push(e)}return b}}}(),function(){window.AlgoliaPlaces=function(a,b){this.init(a,b)},AlgoliaPlaces.prototype={init:function(a,b){this.client=new AlgoliaSearch(a,b,"http",!0,["places-1.algolia.io","places-2.algolia.io","places-3.algolia.io"]),this.cache={}},search:function(a,b,c){var d="query="+encodeURIComponent(a);this.client._isUndefined(c)||null==c||(d=this.client._getSearchParams(c,d));var e={params:d,apiKey:this.client.apiKey,appID:this.client.applicationID};this.client._jsonRequest({cache:this.cache,method:"POST",url:"/1/places/query",body:e,callback:b,removeCustomHTTPHeaders:!0})}}}(),"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(a){return 10>a?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)g[c]=str(c,i)||"null";return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx,escapable,gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})}),"function"!=typeof JSON.parse&&(cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();
|
7
|
+
function AlgoliaExplainResults(a,b,c){function d(a,b){var c=[];if("object"==typeof a&&"matchedWords"in a&&"value"in a){for(var e=!1,f=0;f<a.matchedWords.length;++f){var g=a.matchedWords[f];g in b||(b[g]=1,e=!0)}e&&c.push(a.value)}else if("[object Array]"===Object.prototype.toString.call(a))for(var h=0;h<a.length;++h){var i=d(a[h],b);c=c.concat(i)}else if("object"==typeof a)for(var j in a)a.hasOwnProperty(j)&&(c=c.concat(d(a[j],b)));return c}function e(a,b,c){var f=a._highlightResult||a;if(-1===c.indexOf("."))return c in f?d(f[c],b):[];for(var g=c.split("."),h=f,i=0;i<g.length;++i){if("[object Array]"===Object.prototype.toString.call(h)){for(var j=[],k=0;k<h.length;++k)j=j.concat(e(h[k],b,g.slice(i).join(".")));return j}if(!(g[i]in h))return[];h=h[g[i]]}return d(h,b)}var f={},g={},h=e(a,g,b);if(f.title=h.length>0?h[0]:"",f.subtitles=[],"undefined"!=typeof c)for(var i=0;i<c.length;++i)for(var j=e(a,g,c[i]),k=0;k<j.length;++k)f.subtitles.push({attr:c[i],value:j[k]});return f}var ALGOLIA_VERSION="2.8.6",AlgoliaSearch=function(a,b,c,d,e){this.applicationID=a,this.apiKey=b,this.dsn=!0,this.dsnHost=null,this.hosts=[],this.currentHostIndex=0,this.requestTimeoutInMs=2e3,this.extraHeaders=[],this.jsonp=null;var f,g="net";if("string"==typeof c)f=c;else{var h=c||{};this._isUndefined(h.method)||(f=h.method),this._isUndefined(h.tld)||(g=h.tld),this._isUndefined(h.dsn)||(this.dsn=h.dsn),this._isUndefined(h.hosts)||(e=h.hosts),this._isUndefined(h.dsnHost)||(this.dsnHost=h.dsnHost),this._isUndefined(h.requestTimeoutInMs)||(this.requestTimeoutInMs=+h.requestTimeoutInMs),this._isUndefined(h.jsonp)||(this.jsonp=h.jsonp)}this._isUndefined(e)&&(e=[this.applicationID+"-1.algolia."+g,this.applicationID+"-2.algolia."+g,this.applicationID+"-3.algolia."+g]),this.host_protocol="http://",this._isUndefined(f)||null===f?this.host_protocol=("https:"==document.location.protocol?"https":"http")+"://":("https"===f||"HTTPS"===f)&&(this.host_protocol="https://");for(var i=0;i<e.length;++i)Math.random()>.5&&this.hosts.reverse(),this.hosts.push(this.host_protocol+e[i]);Math.random()>.5&&this.hosts.reverse(),(this.dsn||null!=this.dsnHost)&&this.hosts.unshift(this.dsnHost?this.host_protocol+this.dsnHost:this.host_protocol+this.applicationID+"-dsn.algolia."+g)};AlgoliaSearch.prototype={deleteIndex:function(a,b){this._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(a),callback:b})},moveIndex:function(a,b,c){var d={operation:"move",destination:b};this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,callback:c})},copyIndex:function(a,b,c){var d={operation:"copy",destination:b};this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a)+"/operation",body:d,callback:c})},getLogs:function(a,b,c){this._isUndefined(b)&&(b=0),this._isUndefined(c)&&(c=10),this._jsonRequest({method:"GET",url:"/1/logs?offset="+b+"&length="+c,callback:a})},listIndexes:function(a,b){var c=b?"?page="+b:"";this._jsonRequest({method:"GET",url:"/1/indexes"+c,callback:a})},initIndex:function(a){return new this.Index(this,a)},listUserKeys:function(a){this._jsonRequest({method:"GET",url:"/1/keys",callback:a})},getUserKeyACL:function(a,b){this._jsonRequest({method:"GET",url:"/1/keys/"+a,callback:b})},deleteUserKey:function(a,b){this._jsonRequest({method:"DELETE",url:"/1/keys/"+a,callback:b})},addUserKey:function(a,b){var c={};c.acl=a,this._jsonRequest({method:"POST",url:"/1/keys",body:c,callback:b})},addUserKeyWithValidity:function(a,b,c,d,e){var f=this,g={};g.acl=a,g.validity=b,g.maxQueriesPerIPPerHour=c,g.maxHitsPerQuery=d,this._jsonRequest({method:"POST",url:"/1/indexes/"+f.indexName+"/keys",body:g,callback:e})},setSecurityTags:function(a){if("[object Array]"===Object.prototype.toString.call(a)){for(var b=[],c=0;c<a.length;++c)if("[object Array]"===Object.prototype.toString.call(a[c])){for(var d=[],e=0;e<a[c].length;++e)d.push(a[c][e]);b.push("("+d.join(",")+")")}else b.push(a[c]);a=b.join(",")}this.tagFilters=a},setUserToken:function(a){this.userToken=a},startQueriesBatch:function(){this.batch=[]},addQueryInBatch:function(a,b,c){var d="query="+encodeURIComponent(b);this._isUndefined(c)||null===c||(d=this._getSearchParams(c,d)),this.batch.push({indexName:a,params:d})},clearCache:function(){this.cache={}},sendQueriesBatch:function(a,b){for(var c=this,d={requests:[]},e=0;e<c.batch.length;++e)d.requests.push(c.batch[e]);if(window.clearTimeout(c.onDelayTrigger),!this._isUndefined(b)&&null!==b&&b>0){var f=window.setTimeout(function(){c._sendQueriesBatch(d,a)},b);c.onDelayTrigger=f}else this._sendQueriesBatch(d,a)},setRequestTimeout:function(a){a&&(this.requestTimeoutInMs=parseInt(a,10))},Index:function(a,b){this.indexName=b,this.as=a,this.typeAheadArgs=null,this.typeAheadValueOption=null},setExtraHeader:function(a,b){this.extraHeaders.push({key:a,value:b})},_sendQueriesBatch:function(a,b){if(null===this.jsonp){var c=this;this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:a,callback:function(d,e){d?(c.jsonp=!1,b&&b(d,e)):(c.jsonp=!0,c._sendQueriesBatch(a,b))}})}else if(this.jsonp){for(var d="",e=0;e<a.requests.length;++e){var f="/1/indexes/"+encodeURIComponent(a.requests[e].indexName)+"?"+a.requests[e].params;d+=e+"="+encodeURIComponent(f)+"&"}var g={params:d};this._jsonRequest({cache:this.cache,method:"GET",url:"/1/indexes/*",body:g,callback:b})}else this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:a,callback:b})},_jsonRequest:function(a){var b=this,c=a.callback,d=null,e=a.url;if(this._isUndefined(a.body)||(e=a.url+"_body_"+JSON.stringify(a.body)),!this._isUndefined(a.cache)&&(d=a.cache,!this._isUndefined(d[e])))return void(this._isUndefined(c)||setTimeout(function(){c(!0,d[e])},1));a.successiveRetryCount=0;var f=function(){return a.successiveRetryCount>=b.hosts.length?void(b._isUndefined(c)||(a.successiveRetryCount=0,c(!1,{message:"Cannot connect the Algolia's Search API. Please send an email to support@algolia.com to report the issue."}))):(a.callback=function(g,h,i,j){h||b._isUndefined(j)||window.console&&console.log("Error: "+j.message),h&&!b._isUndefined(a.cache)&&(d[e]=j),!h&&g?(b.currentHostIndex=++b.currentHostIndex%b.hosts.length,a.successiveRetryCount+=1,f()):(a.successiveRetryCount=0,b._isUndefined(c)||c(h,j))},a.hostname=b.hosts[b.currentHostIndex],void b._jsonRequestByHost(a))};f()},_jsonRequestByHost:function(a){var b=a.hostname+a.url;this.jsonp?this._makeJsonpRequestByHost(b,a):this._makeXmlHttpRequestByHost(b,a)},_makeJsonpRequestByHost:function(a,b){if("GET"!==b.method)return void b.callback(!0,!1,null,{message:"Method "+b.method+" "+a+" is not supported by JSONP."});this.jsonpCounter=this.jsonpCounter||0,this.jsonpCounter+=1;var c=document.getElementsByTagName("head")[0],d=document.createElement("script"),e="algoliaJSONP_"+this.jsonpCounter,f=!1,g=null;window[e]=function(a){b.callback(!1,!0,null,a);try{delete window[e]}catch(c){window[e]=void 0}},d.type="text/javascript",d.src=a+"?callback="+e+"&X-Algolia-Application-Id="+this.applicationID+"&X-Algolia-API-Key="+this.apiKey,this.tagFilters&&(d.src+="&X-Algolia-TagFilters="+encodeURIComponent(this.tagFilters)),this.userToken&&(d.src+="&X-Algolia-UserToken="+encodeURIComponent(this.userToken));for(var h=0;h<this.extraHeaders.length;++h)d.src+="&"+this.extraHeaders[h].key+"="+this.extraHeaders[h].value;b.body&&b.body.params&&(d.src+="&"+b.body.params),g=setTimeout(function(){d.onload=d.onreadystatechange=d.onerror=null,window[e]=function(){try{delete window[e]}catch(a){window[e]=void 0}},b.callback(!0,!1,null,{message:"Timeout - Failed to load JSONP script."}),c.removeChild(d),clearTimeout(g),g=null},this.requestTimeoutInMs),d.onload=d.onreadystatechange=function(){if(clearTimeout(g),g=null,!(f||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState)){if(f=!0,"undefined"==typeof window[e+"_loaded"]){b.callback(!0,!1,null,{message:"Failed to load JSONP script."});try{delete window[e]}catch(a){window[e]=void 0}}else try{delete window[e+"_loaded"]}catch(a){window[e+"_loaded"]=void 0}d.onload=d.onreadystatechange=null,c.removeChild(d)}},d.onerror=function(){clearTimeout(g),g=null,b.callback(!0,!1,null,{message:"Failed to load JSONP script."}),c.removeChild(d);try{delete window[e]}catch(a){window[e]=void 0}},c.appendChild(d)},_makeXmlHttpRequestByHost:function(a,b){var c=this,d=window.XMLHttpRequest?new XMLHttpRequest:{},e=null,f=null;this._isUndefined(b.body)||(e=JSON.stringify(b.body)),a+=(-1===a.indexOf("?")?"?":"&")+"X-Algolia-API-Key="+this.apiKey,a+="&X-Algolia-Application-Id="+this.applicationID,this.userToken&&(a+="&X-Algolia-UserToken="+encodeURIComponent(this.userToken)),this.tagFilters&&(a+="&X-Algolia-TagFilters="+encodeURIComponent(this.tagFilters));for(var g=0;g<this.extraHeaders.length;++g)a+="&"+this.extraHeaders[g].key+"="+this.extraHeaders[g].value;if("withCredentials"in d)d.open(b.method,a,!0),d.timeout=this.requestTimeoutInMs*(b.successiveRetryCount+1),null!==e&&d.setRequestHeader("Content-type","application/x-www-form-urlencoded");else{if("undefined"==typeof XDomainRequest)return void b.callback(!1,!1,null,{message:"CORS not supported"});d=new XDomainRequest,d.open(b.method,a)}f=setTimeout(function(){return d.abort(),d.aborted===!0?void stopLoadAnimation():(b.callback(!0,!1,null,{message:"Timeout - Could not connect to endpoint "+a}),clearTimeout(f),void(f=null))},this.requestTimeoutInMs*(b.successiveRetryCount+1)),d.onload=function(a){if(clearTimeout(f),f=null,c._isUndefined(a)||null===a.target)b.callback(!1,!0,a,JSON.parse(d.responseText));else{var e=0===a.target.status||503===a.target.status,g=!1,h=null;"undefined"!=typeof XDomainRequest?(h=a.target.responseText,g=h&&h.length>0):(h=a.target.response,g=200===a.target.status||201===a.target.status),b.callback(e,g,a.target,h?JSON.parse(h):null)}},d.ontimeout=function(){},d.onerror=function(a){clearTimeout(f),f=null,b.callback(!0,!1,null,{message:"Could not connect to host",error:a})},d.send(e)},_getSearchParams:function(a,b){if(this._isUndefined(a)||null===a)return b;for(var c in a)null!==c&&a.hasOwnProperty(c)&&(b+=0===b.length?"?":"&",b+=c+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(a[c])?JSON.stringify(a[c]):a[c]));return b},_isUndefined:function(a){return void 0===a},applicationID:null,apiKey:null,tagFilters:null,userToken:null,hosts:[],cache:{},extraHeaders:[]},AlgoliaSearch.prototype.Index.prototype={clearCache:function(){this.cache={}},addObject:function(a,b,c){var d=this;this.as._jsonRequest(this.as._isUndefined(c)?{method:"POST",url:"/1/indexes/"+encodeURIComponent(d.indexName),body:a,callback:b}:{method:"PUT",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(c),body:a,callback:b})},addObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"addObject",body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},getObject:function(a,b,c){var d=this,e="";if(!this.as._isUndefined(c)){e="?attributes=";for(var f=0;f<c.length;++f)0!==f&&(e+=","),e+=c[f]}if(null===this.as.jsonp)this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(a)+e,callback:b});else{var g={params:e};this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/"+encodeURIComponent(a),callback:b,body:g})}},partialUpdateObject:function(a,b){var c=this;this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a.objectID)+"/partial",body:a,callback:b})},partialUpdateObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"partialUpdateObject",objectID:a[e].objectID,body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},saveObject:function(a,b){var c=this;this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a.objectID),body:a,callback:b})},saveObjects:function(a,b){for(var c=this,d={requests:[]},e=0;e<a.length;++e){var f={action:"updateObject",objectID:a[e].objectID,body:a[e]};d.requests.push(f)}this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/batch",body:d,callback:b})},deleteObject:function(a,b){if(null===a||0===a.length)return void b(!1,{message:"empty objectID"});var c=this;this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/"+encodeURIComponent(a),callback:b})},search:function(a,b,c,d){var e=this,f="query="+encodeURIComponent(a);if(this.as._isUndefined(c)||null===c||(f=this.as._getSearchParams(c,f)),window.clearTimeout(e.onDelayTrigger),!this.as._isUndefined(d)&&null!==d&&d>0){var g=window.setTimeout(function(){e._search(f,b)},d);e.onDelayTrigger=g}else this._search(f,b)},browse:function(a,b,c){var d=this,e="?page="+a;this.as._isUndefined(c)||(e+="&hitsPerPage="+c),this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(d.indexName)+"/browse"+e,callback:b})},ttAdapter:function(a){var b=this;return function(c,d){b.search(c,function(a,b){a&&d(b.hits)},a)}},waitTask:function(a,b){var c=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/task/"+a,callback:function(d,e){d?"published"===e.status?b(!0,e):setTimeout(function(){c.waitTask(a,b)},100):b(!1,e)}})},clearIndex:function(a){var b=this;this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/clear",callback:a})},getSettings:function(a){var b=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/settings",callback:a})},setSettings:function(a,b){var c=this;this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/settings",body:a,callback:b})},listUserKeys:function(a){var b=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(b.indexName)+"/keys",callback:a})},getUserKeyACL:function(a,b){var c=this;this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys/"+a,callback:b})},deleteUserKey:function(a,b){var c=this;this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys/"+a,callback:b})},addUserKey:function(a,b){var c=this,d={};d.acl=a,this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/keys",body:d,callback:b})},addUserKeyWithValidity:function(a,b,c,d,e){var f=this,g={};g.acl=a,g.validity=b,g.maxQueriesPerIPPerHour=c,g.maxHitsPerQuery=d,this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(f.indexName)+"/keys",body:g,callback:e})},_search:function(a,b){var c={params:a};if(null===this.as.jsonp){var d=this;this.as._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:c,callback:function(c,e){c?(d.as.jsonp=!1,b&&b(c,e)):(d.as.jsonp=!0,d._search(a,b))}})}else this.as._jsonRequest(this.as.jsonp?{cache:this.cache,method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName),body:c,callback:b}:{cache:this.cache,method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:c,callback:b})},as:null,indexName:null,cache:{},typeAheadArgs:null,typeAheadValueOption:null,emptyConstructor:function(){}},function(){var a=function(a){a=a||{};for(var b=1;b<arguments.length;b++)if(arguments[b])for(var c in arguments[b])arguments[b].hasOwnProperty(c)&&(a[c]=arguments[b][c]);return a};window.AlgoliaSearchHelper=function(b,c,d){var e={facets:[],disjunctiveFacets:[],hitsPerPage:20,defaultFacetFilters:[]};this.init(b,c,a({},e,d))},AlgoliaSearchHelper.prototype={init:function(a,b,c){this.client=a,this.index=b,this.options=c,this.page=0,this.refinements={},this.disjunctiveRefinements={},this.extraQueries=[]},search:function(a,b,c){this.q=a,this.searchCallback=b,this.searchParams=c||{},this.page=this.page||0,this.refinements=this.refinements||{},this.disjunctiveRefinements=this.disjunctiveRefinements||{},this._search()},clearRefinements:function(){this.disjunctiveRefinements={},this.refinements={}},addDisjunctiveRefine:function(a,b){this.disjunctiveRefinements=this.disjunctiveRefinements||{},this.disjunctiveRefinements[a]=this.disjunctiveRefinements[a]||{},this.disjunctiveRefinements[a][b]=!0},removeDisjunctiveRefine:function(a,b){this.disjunctiveRefinements=this.disjunctiveRefinements||{},this.disjunctiveRefinements[a]=this.disjunctiveRefinements[a]||{};try{delete this.disjunctiveRefinements[a][b]}catch(c){this.disjunctiveRefinements[a][b]=void 0}},addRefine:function(a,b){var c=a+":"+b;this.refinements=this.refinements||{},this.refinements[c]=!0},removeRefine:function(a,b){var c=a+":"+b;this.refinements=this.refinements||{},this.refinements[c]=!1},toggleRefine:function(a,b){for(var c=0;c<this.options.facets.length;++c)if(this.options.facets[c]==a){var d=a+":"+b;return this.refinements[d]=!this.refinements[d],this.page=0,this._search(),!0}this.disjunctiveRefinements[a]=this.disjunctiveRefinements[a]||{};for(var e=0;e<this.options.disjunctiveFacets.length;++e)if(this.options.disjunctiveFacets[e]==a)return this.disjunctiveRefinements[a][b]=!this.disjunctiveRefinements[a][b],this.page=0,this._search(),!0;return!1},isRefined:function(a,b){var c=a+":"+b;return this.refinements[c]?!0:this.disjunctiveRefinements[a]&&this.disjunctiveRefinements[a][b]?!0:!1},nextPage:function(){this._gotoPage(this.page+1)},previousPage:function(){this.page>0&&this._gotoPage(this.page-1)},gotoPage:function(a){this._gotoPage(a)},setPage:function(a){this.page=a},setIndex:function(a){this.index=a},getIndex:function(){return this.index},clearExtraQueries:function(){this.extraQueries=[]},addExtraQuery:function(a,b,c){this.extraQueries.push({index:a,query:b,params:c||{}})},_gotoPage:function(a){this.page=a,this._search()},_search:function(){this.client.startQueriesBatch(),this.client.addQueryInBatch(this.index,this.q,this._getHitsSearchParams());for(var a=[],b={},c=0;c<this.options.disjunctiveFacets.length;++c){var d=this.options.disjunctiveFacets[c];this._hasDisjunctiveRefinements(d)?a.push(d):b[d]=!0}for(var c=0;c<a.length;++c)this.client.addQueryInBatch(this.index,this.q,this._getDisjunctiveFacetSearchParams(a[c]));for(var c=0;c<this.extraQueries.length;++c)this.client.addQueryInBatch(this.extraQueries[c].index,this.extraQueries[c].query,this.extraQueries[c].params);var e=this;this.client.sendQueriesBatch(function(c,d){if(!c)return void e.searchCallback(!1,d);var f=d.results[0];f.disjunctiveFacets=f.disjunctiveFacets||{},f.facetStats=f.facetStats||{};for(var g in b)if(f.facets[g]&&!f.disjunctiveFacets[g]){f.disjunctiveFacets[g]=f.facets[g];try{delete f.facets[g]}catch(h){f.facets[g]=void 0}}for(var i=0;i<a.length;++i){for(var g in d.results[i+1].facets)if(f.disjunctiveFacets[g]=d.results[i+1].facets[g],e.disjunctiveRefinements[g])for(var j in e.disjunctiveRefinements[g])!f.disjunctiveFacets[g][j]&&e.disjunctiveRefinements[g][j]&&(f.disjunctiveFacets[g][j]=0);for(var k in d.results[i+1].facets_stats)f.facetStats[k]=d.results[i+1].facets_stats[k]}if(0===e.extraQueries.length)e.searchCallback(!0,f);else{for(var l={results:[f]},i=0;i<e.extraQueries.length;++i)l.results.push(d.results[1+a.length+i]);e.searchCallback(!0,l)}})},_getHitsSearchParams:function(){for(var b=[],c=0;c<this.options.facets.length;++c)b.push(this.options.facets[c]);for(var c=0;c<this.options.disjunctiveFacets.length;++c){var d=this.options.disjunctiveFacets[c];this._hasDisjunctiveRefinements(d)||b.push(d)}return a({},{hitsPerPage:this.options.hitsPerPage,page:this.page,facets:b,facetFilters:this._getFacetFilters()},this.searchParams)},_getDisjunctiveFacetSearchParams:function(b){return a({},this.searchParams,{hitsPerPage:1,page:0,attributesToRetrieve:[],attributesToHighlight:[],attributesToSnippet:[],facets:b,facetFilters:this._getFacetFilters(b)})},_hasDisjunctiveRefinements:function(a){for(var b in this.disjunctiveRefinements[a])if(this.disjunctiveRefinements[a][b])return!0;return!1},_getFacetFilters:function(a){var b=[];if(this.options.defaultFacetFilters)for(var c=0;c<this.options.defaultFacetFilters.length;++c)b.push(this.options.defaultFacetFilters[c]);for(var d in this.refinements)this.refinements[d]&&b.push(d);for(var e in this.disjunctiveRefinements)if(e!=a){var f=[];for(var g in this.disjunctiveRefinements[e])this.disjunctiveRefinements[e][g]&&f.push(e+":"+g);f.length>0&&b.push(f)}return b}}}(),function(){window.AlgoliaPlaces=function(a,b){this.init(a,b)},AlgoliaPlaces.prototype={init:function(a,b){this.client=new AlgoliaSearch(a,b,"http",!0,["places-1.algolia.io","places-2.algolia.io","places-3.algolia.io"]),this.cache={}},search:function(a,b,c){var d="query="+encodeURIComponent(a);this.client._isUndefined(c)||null==c||(d=this.client._getSearchParams(c,d));var e={params:d,apiKey:this.client.apiKey,appID:this.client.applicationID};this.client._jsonRequest({cache:this.cache,method:"POST",url:"/1/places/query",body:e,callback:b,removeCustomHTTPHeaders:!0})}}}(),"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(a){return 10>a?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)g[c]=str(c,i)||"null";return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx,escapable,gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})}),"function"!=typeof JSON.parse&&(cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: algoliasearch-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.11.
|
4
|
+
version: 1.11.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Algolia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|