From f20d1b82c66cdbd916028e275ee073773ce05191 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 14 Nov 2022 17:41:53 +0100 Subject: [PATCH] fix(answers): deprecate findAnswers (algolia/algoliasearch-helper-js#919) While this method still works, it's not used in InstantSearch and it no longer has any difference from a regular search, and therefore no longer needs its own function. --- packages/algoliasearch-helper/index.d.ts | 1 + packages/algoliasearch-helper/src/algoliasearch.helper.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/algoliasearch-helper/index.d.ts b/packages/algoliasearch-helper/index.d.ts index 79830a87d1..65d7f5f721 100644 --- a/packages/algoliasearch-helper/index.d.ts +++ b/packages/algoliasearch-helper/index.d.ts @@ -147,6 +147,7 @@ declare namespace algoliasearchHelper { * @param {string[]} options.attributesForPrediction - Attributes to use for predictions. If empty, `searchableAttributes` is used instead. * @param {string[]} options.queryLanguages - The languages in the query. Currently only supports ['en']. * @param {number} options.nbHits - Maximum number of answers to retrieve from the Answers Engine. Cannot be greater than 1000. + * @deprecated answers is deprecated and will be replaced with new initiatives */ findAnswers(options: { attributesForPrediction: string[]; diff --git a/packages/algoliasearch-helper/src/algoliasearch.helper.js b/packages/algoliasearch-helper/src/algoliasearch.helper.js index 95393e331b..36cad939cf 100644 --- a/packages/algoliasearch-helper/src/algoliasearch.helper.js +++ b/packages/algoliasearch-helper/src/algoliasearch.helper.js @@ -260,8 +260,10 @@ AlgoliaSearchHelper.prototype.searchOnce = function(options, cb) { * @param {number} options.nbHits - Maximum number of answers to retrieve from the Answers Engine. Cannot be greater than 1000. * * @return {promise} the answer results + * @deprecated answers is deprecated and will be replaced with new initiatives */ AlgoliaSearchHelper.prototype.findAnswers = function(options) { + console.warn('[algoliasearch-helper] answers is no longer supported'); var state = this.state; var derivedHelper = this.derivedHelpers[0]; if (!derivedHelper) {