How to use the algoliasearch-helper.SearchResults 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 / react-instantsearch / packages / react-instantsearch-core / src / connectors / __tests__ / connectRange.js View on Github external
canRefine: false,
        precision: 2,
      });

      props = connect.getProvidedProps.call(
        instance,
        {
          attribute: 'ok',
          precision: 2,
          contextValue,
          indexContextValue,
        },
        {},
        {
          results: {
            second: new SearchResults(new SearchParameters(), [{ hits: [] }]),
          },
        }
      );
      expect(props).toEqual({
        min: undefined,
        max: undefined,
        currentRefinement: {
          min: undefined,
          max: undefined,
        },
        count: [],
        canRefine: false,
        precision: 2,
      });
    });
github algolia / react-instantsearch / packages / react-instantsearch-core / src / connectors / __tests__ / connectGeoSearch.js View on Github external
const createMultiIndexSearchResults = (hits = [], state) => ({
      results: {
        second: new SearchResults(new SearchParameters(state), [
          {
            hits,
          },
        ]),
      },
    });
github algolia / react-instantsearch / packages / react-instantsearch-core / src / connectors / __tests__ / connectGeoSearch.js View on Github external
const createSingleIndexSearchResults = (hits = [], state) => ({
      results: new SearchResults(new SearchParameters(state), [
        {
          hits,
        },
      ]),
    });
github algolia / react-instantsearch / packages / react-instantsearch-core / src / connectors / __tests__ / connectRange.js View on Github external
currentRefinement: { min: 6, max: 9 },
        count: [],
        canRefine: false,
        precision: 2,
      });

      props = connect.getProvidedProps.call(
        {},
        {
          attribute: 'ok',
          precision: 2,
          contextValue,
        },
        {},
        {
          results: new SearchResults(new SearchParameters(), [{ hits: [] }]),
        }
      );
      expect(props).toEqual({
        min: undefined,
        max: undefined,
        currentRefinement: {
          min: undefined,
          max: undefined,
        },
        count: [],
        canRefine: false,
        precision: 2,
      });

      expect(() =>
        connect.getProvidedProps.call(
github algolia / react-instantsearch / packages / react-instantsearch-core / src / connectors / __tests__ / connectToggleRefinement.js View on Github external
const createSearchResults = ({ disjunctiveFacets, facets }) =>
  new SearchResults(
    new SearchParameters({
      disjunctiveFacets,
    }),
    [
      {
        facets,
        hits: [
          { objectID: '0123', name: 'Apple' },
          { objectID: '0123', name: 'Samsung' },
          { objectID: '0123', name: 'Microsoft' },
        ],
      },
    ]
  );
github algolia / react-instantsearch / packages / react-instantsearch-core / src / core / createInstantSearchManager.js View on Github external
}

    if (Array.isArray(results)) {
      return results.reduce(
        (acc, result) => ({
          ...acc,
          [result._internalIndexId]: new algoliasearchHelper.SearchResults(
            new algoliasearchHelper.SearchParameters(result.state),
            result.rawResults
          ),
        }),
        {}
      );
    }

    return new algoliasearchHelper.SearchResults(
      new algoliasearchHelper.SearchParameters(results.state),
      results.rawResults
    );
  }
github algolia / react-instantsearch / packages / react-instantsearch-core / src / core / createInstantSearchManager.js View on Github external
(acc, result) => ({
          ...acc,
          [result._internalIndexId]: new algoliasearchHelper.SearchResults(
            new algoliasearchHelper.SearchParameters(result.state),
            result.rawResults
          ),
        }),
        {}
github algolia / vue-instantsearch / src / helper-serializer.js View on Github external
export const deserialize = function(data) {
  const client = algoliaClient(data.appId, data.apiKey);
  const helper = algoliaHelper(
    client,
    data.searchParameters.index,
    data.searchParameters
  );

  if (data.response) {
    helper.lastResults = new algoliaHelper.SearchResults(
      helper.state,
      data.response
    );
  }

  return helper;
};