How to use @algolia/client-search - 10 common examples

To help you get started, we’ve selected a few @algolia/client-search 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 / algoliasearch-client-javascript / packages / client-account / src / methods / accountCopyIndex.ts View on Github external
.then(() =>
      browseObjects(source)({
        // eslint-disable-next-line functional/immutable-data
        batch: objects => responses.push(saveObjects(destination)(objects, requestOptions)),
      })
    )
github algolia / algoliasearch-client-javascript / packages / client-account / src / methods / accountCopyIndex.ts View on Github external
.then(() =>
      browseRules(source)({
        // eslint-disable-next-line functional/immutable-data
        batch: rules => responses.push(saveRules(destination)(rules, requestOptions)),
      })
    )
github algolia / algoliasearch-client-javascript / packages / client-account / src / methods / accountCopyIndex.ts View on Github external
.then(() =>
      browseSynonyms(source)({
        // eslint-disable-next-line functional/immutable-data
        batch: synonyms => responses.push(saveSynonyms(destination)(synonyms, requestOptions)),
      })
    )
github algolia / algoliasearch-client-javascript / packages / client-account / src / methods / accountCopyIndex.ts View on Github external
export const accountCopyIndex = (
  source: SearchIndex,
  destination: SearchIndex,
  requestOptions: RequestOptions
): WaitablePromise => {
  // eslint-disable-next-line functional/prefer-readonly-type
  const responses: Array> = [];

  const promise = exists(destination)()
    .then(res => {
      if (source.appId === destination.appId) {
        throw createIndicesInSameAppError(source.appId);
      }

      if (res) {
        throw createDestinationIndiceExistsError();
      }
    })
    .then(() => getSettings(source)())
    .then(settings =>
      // eslint-disable-next-line functional/immutable-data
      responses.push(setSettings(destination)(settings, requestOptions))
    )
    .then(() =>
      browseRules(source)({
github algolia / algoliasearch-client-javascript / packages / client-account / src / methods / accountCopyIndex.ts View on Github external
.then(settings =>
      // eslint-disable-next-line functional/immutable-data
      responses.push(setSettings(destination)(settings, requestOptions))
    )
github algolia / algoliasearch-client-javascript / packages / algoliasearch / src / builds / node.ts View on Github external
connect: 2,
      read: 5,
      write: 30,
    },
    requester: createNodeHttpRequester(),
    logger: createNullLogger(),
    responsesCache: createNullCache(),
    requestsCache: createNullCache(),
    hostsCache: createInMemoryCache(),
    userAgent: createUserAgent(version).add({
      segment: 'Node.js',
      version: process.versions.node,
    }),
  };

  return createSearchClient({
    ...clientOptions,
    methods: {
      search: multipleQueries,
      searchForFacetValues: multipleSearchForFacetValues,
      multipleBatch,
      multipleGetObjects,
      multipleQueries,
      copyIndex,
      copySettings,
      copySynonyms,
      moveIndex,
      listIndices,
      getLogs,
      listClusters,
      multipleSearchForFacetValues,
      getApiKey,
github algolia / algoliasearch-client-javascript / packages / algoliasearch / src / builds / browserLite.ts View on Github external
export default function algoliasearch(
  appId: string,
  apiKey: string,
  options: AlgoliaSearchOptions = {}
): SearchClient {
  const logger = createConsoleLogger(options.logLevel || LogLevelEnum.Error);

  return createSearchClient({
    appId,
    apiKey,
    timeouts: {
      connect: 1,
      read: 2,
      write: 30,
    },
    requester: createBrowserXhrRequester(),
    logger,
    responsesCache: createInMemoryCache(),
    requestsCache: createInMemoryCache({ serializable: false }),
    hostsCache: createFallbackableCache({
      caches: [
        createBrowserLocalStorageCache({ key: `${version}-${appId}` }),
        createInMemoryCache(),
      ],
github algolia / algoliasearch-client-javascript / packages / algoliasearch / src / builds / browser.ts View on Github external
timeouts: {
      connect: 1,
      read: 2,
      write: 30,
    },
    requester: createBrowserXhrRequester(),
    logger,
    responsesCache: createInMemoryCache(),
    requestsCache: createInMemoryCache({ serializable: false }),
    hostsCache: createFallbackableCache({
      caches: [createBrowserLocalStorageCache({ version }), createInMemoryCache()],
    }),
    userAgent: createUserAgent(version).add({ segment: 'Browser' }),
  };

  return createSearchClient({
    ...clientOptions,
    methods: {
      search: multipleQueries,
      searchForFacetValues: multipleSearchForFacetValues,
      multipleBatch,
      multipleGetObjects,
      multipleQueries,
      copyIndex,
      copySettings,
      copySynonyms,
      moveIndex,
      listIndices,
      getLogs,
      listClusters,
      multipleSearchForFacetValues,
      getApiKey,
github algolia / algoliasearch-client-javascript / packages / client-account / src / methods / accountCopyIndex.ts View on Github external
        batch: objects => responses.push(saveObjects(destination)(objects, requestOptions)),
      })