How to use the algoliasearch-helper.AlgoliaSearchHelper function in algoliasearch-helper

To help you get started, we’ve selected a few algoliasearch-helper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / vue-instantsearch / src / store.js View on Github external
constructor(helper, { stalledSearchDelay = 200 } = {}) {
    if (!(helper instanceof algoliaHelper.AlgoliaSearchHelper)) {
      throw new TypeError(
        'Store should be constructed with an AlgoliaSearchHelper instance as first parameter.'
      );
    }
    // We require one start() call to execute the first search query.
    // Allows every widget to alter the state at initialization
    // without trigger multiple queries.
    this._stoppedCounter = 1;

    this._highlightPreTag = '<em>';
    this._highlightPostTag = '</em>';

    this._cacheEnabled = true;

    this._stalledSearchDelay = stalledSearchDelay;
github algolia / react-instantsearch / src / lib / url-sync.js View on Github external
import algoliasearchHelper from 'algoliasearch-helper';
import version from '../lib/version.js';
import urlHelper from 'algoliasearch-helper/src/url';
import isEqual from 'lodash/lang/isEqual';
import merge from 'lodash/object/merge';/**/

const AlgoliaSearchHelper = algoliasearchHelper.AlgoliaSearchHelper;
const majorVersionNumber = version.split('.')[0];
let firstRender = true;

function timerMaker(t0) {
  let t = t0;
  return function timer() {
    const now = Date.now();
    const delta = now - t;
    t = now;
    return delta;
  };
}

/**
 * @typedef {object} UrlUtil
 * @property {string} character the character used in the url
github algolia / vue-instantsearch / src / helper-serializer.js View on Github external
export const serialize = function(helper) {
  if (!(helper instanceof algoliaHelper.AlgoliaSearchHelper)) {
    throw new TypeError('Serialize expects an algolia helper instance.');
  }

  const client = helper.getClient();

  const response = helper.lastResults ? helper.lastResults._rawResults : null;

  const serialized = {
    searchParameters: Object.assign({}, helper.state),
    appId: client.applicationID,
    apiKey: client.apiKey,
    response,
  };

  return serialized;
};