Skip to content

Commit 9b307c4

Browse files
authored
Merge pull request #27 from AddSearch/range-facets-support
custom API fetch to retrieve range facets
2 parents a8f8d22 + 6425117 commit 9b307c4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/index.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,22 @@ var client = function(sitekey, privatekey) {
103103
executeApiFetch(this.apiHostname, this.sitekey, 'search', settingsCloned, callback, null, customFilterObject);
104104
}
105105

106+
/**
107+
* Fetch Range Facets
108+
*/
109+
this.fetchRangeFacets = function(options, customFilterObject, callback) {
110+
var settingsCloned = Object.assign({}, this.settings.getSettings());
111+
112+
if (!settingsCloned.rangeFacets) {
113+
settingsCloned.rangeFacets = [];
114+
}
115+
settingsCloned.rangeFacets.push({
116+
field: options.field,
117+
ranges: options.ranges
118+
});
119+
executeApiFetch(this.apiHostname, this.sitekey, 'search', settingsCloned, callback, null, customFilterObject);
120+
}
121+
106122
/**
107123
* Indexing API functions
108124
*/

0 commit comments

Comments
 (0)