Releases: AddSearch/js-client-library
v0.5.0
Added functions to use Indexing API to create, update, fetch, and delete single documents or batches of documents. The full indexing API documentation can be found at addsearch.com
Example of indexing a document:
// Define a document (schemaless)
const doc = {
custom_fields: {
'name': 'Example product',
'description': 'Description for the example product',
'price_cents': 599,
'average_customer_rating': 4.5
}
};
// Save the document
client.saveDocument(doc)
.then(response => {
console.log(response);
})
.catch(error => {
console.log(error);
});
v0.4.3
Added support for field statistics. With this feature, you can add minimum, maximum, and average values of numerical or date-based custom fields to the search response. See documentation
v0.4.2
Added support for range facets. The feature can be used to group numerical custom fields into range buckets. See documentation
v0.4.1
v0.4.0
v0.3.1
v0.3.0
New functions to control Search Analytics:
- sendStatsEvent to send search queries and clicks to analytics
- setStatsSessionId and getStatsSessionId to manually control the search session ID or to share the ID between multiple client instances. Only the last keyword of a single session is shown on the Analytics Dashboard.
Deprecated searchResultClicked function and it should be replaced with sendStatsEvent:
// documentId is the 32-character long id that is part of each hit in search results.
// position is the position of the document that was clicked, the first result being 1
client.sendStatsEvent('click', keyword, {documentId: id, position: n});
v0.2.4
New functions to query custom field autocompletion and define the number of results to fetch.
client.setAutocompleteSize(20);
client.autocomplete('custom_fields.brand', 'a', callback); // "adidas, apple, azure"
New function to use a filtering object with complex setup.
var filter = {
'and':[
{'custom_fields.brand': 'apple'},
{'not': {'custom_fields.color': 'white'}},
{'range': {'custom_fields.price': {'gt': 200, 'lt':500}}}
]
};
client.setFilterObject(filter);