Use Winnow with InstantSearch.js

Winnow exposes an InstantSearch-compatible endpoint for sites that already use Algolia's UI widgets and want Winnow to answer the search requests.

Send InstantSearch multi-query requests with POST to https://edge.winnow-sear.ch/api/search/instantsearch/YOUR_SITE_ID.

Replace YOUR_SITE_ID with your Winnow Site ID.

Search client

InstantSearch accepts any object with a search(requests) method. Use this adapter with a Winnow Site ID from your admin pages.

const siteId = "site_abc123";
const searchClient = {
  async search(requests) {
    const endpoint = `https://edge.winnow-sear.ch/api/search/instantsearch/${siteId}`;

    const response = await fetch(endpoint, {
      method: "POST",
      headers: { "content-type": "application/json" },
      body: JSON.stringify({ requests }),
    });

    if (!response.ok) {
      const error = await response.json().catch(() => ({}));
      throw new Error(error.message || `Winnow search failed with ${response.status}`);
    }

    return response.json();
  },
};

const search = instantsearch({
  indexName: "winnow",
  searchClient,
});

Demo

We have a rudimentary demo showing InstantSearch using the Winnow backend that you can play with right on this page.

The search results are the same as those you would get by using the native Winnow search interface in the navigation at the top of the page.

Supported widgets

Winnow supports the ordinary search flow used by searchBox, hits, pagination, and infiniteHits.

Facets, filter menus, searchable facet values, recommendations, Insights events, and refinement widgets are not supported by this endpoint.

Request shape

Winnow accepts Algolia-style { requests } payloads. Each request can pass params as a URL-encoded string or as an object.

{
  "requests": [
    {
      "indexName": "winnow",
      "params": "query=garden&page=0&hitsPerPage=20"
    }
  ]
}