diff --git a/documentation-src/metalsmith/content/reference.md b/documentation-src/metalsmith/content/reference.md index 9778490a3..4dc07c736 100644 --- a/documentation-src/metalsmith/content/reference.md +++ b/documentation-src/metalsmith/content/reference.md @@ -83,7 +83,6 @@ documentation](https://www.algolia.com/doc/rest#query-an-index). Before using those methods, be sure to check [the shortcuts](query-parameters-shortcuts). {{> jsdoc jsdoc/helper/setQueryParameter}} -{{> jsdoc jsdoc/helper/getQueryParameter}} ### Conjunctive Facets @@ -558,7 +557,6 @@ All the attributes specific to the helper are described below: {{> jsdoc jsdoc/state/getHierarchicalRefinement}} {{> jsdoc jsdoc/state/getNumericRefinements}} {{> jsdoc jsdoc/state/getNumericRefinement}} -{{> jsdoc jsdoc/state/getQueryParameter}} {{> jsdoc jsdoc/state/getRefinedDisjunctiveFacets}} {{> jsdoc jsdoc/state/getRefinedHierarchicalFacets}} {{> jsdoc jsdoc/state/getUnrefinedDisjunctiveFacets}} diff --git a/src/SearchParameters/index.js b/src/SearchParameters/index.js index 38a8a9048..319bb364c 100644 --- a/src/SearchParameters/index.js +++ b/src/SearchParameters/index.js @@ -1310,20 +1310,6 @@ SearchParameters.prototype = { return queryParams; }, - /** - * Let the user retrieve any parameter value from the SearchParameters - * @param {string} paramName name of the parameter - * @return {any} the value of the parameter - */ - getQueryParameter: function getQueryParameter(paramName) { - if (!this.hasOwnProperty(paramName)) { - throw new Error( - "Parameter '" + paramName + "' is not an attribute of SearchParameters " + - '(http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)'); - } - - return this[paramName]; - }, /** * Let the user set a specific value for a given parameter. Will return the * same instance if the parameter is invalid or if the value is the same as the diff --git a/src/algoliasearch.helper.js b/src/algoliasearch.helper.js index 2beb30b0e..da9a11403 100644 --- a/src/algoliasearch.helper.js +++ b/src/algoliasearch.helper.js @@ -1073,24 +1073,6 @@ AlgoliaSearchHelper.prototype.getTags = function() { return this.state.tagRefinements; }; -/** - * Get a parameter of the search by its name. It is possible that a parameter is directly - * defined in the index dashboard, but it will be undefined using this method. - * - * The complete list of parameters is - * available on the - * [Algolia website](https://www.algolia.com/doc/rest#query-an-index). - * The most commonly used parameters have their own [shortcuts](#query-parameters-shortcuts) - * or benefit from higher-level APIs (all the kind of filters have their own API) - * @param {string} parameterName the parameter name - * @return {any} the parameter value - * @example - * var hitsPerPage = helper.getQueryParameter('hitsPerPage'); - */ -AlgoliaSearchHelper.prototype.getQueryParameter = function(parameterName) { - return this.state.getQueryParameter(parameterName); -}; - /** * Get the list of refinements for a given attribute. This method works with * conjunctive, disjunctive, excluding and numerical filters. diff --git a/test/spec/algoliasearch.helper/getQueryParameter.js b/test/spec/algoliasearch.helper/getQueryParameter.js deleted file mode 100644 index 0bb216a15..000000000 --- a/test/spec/algoliasearch.helper/getQueryParameter.js +++ /dev/null @@ -1,21 +0,0 @@ -'use strict'; - -var algoliaSearchHelper = require('../../../index.js'); - -var fakeClient = {}; - -test('getQueryParameter', function() { - var bind = require('lodash/bind'); - - var helper = algoliaSearchHelper(fakeClient, null, { - facets: ['facet1'], - minWordSizefor1Typo: 8, - ignorePlurals: true - }); - - expect(helper.getQueryParameter('facets')).toEqual(['facet1']); - expect(helper.getQueryParameter('minWordSizefor1Typo')).toBe(8); - expect(helper.getQueryParameter('ignorePlurals')).toBe(true); - - expect(bind(helper.getQueryParameter, helper, 'unknown')).toThrow(); -});