Convert Figma logo to code with AI

algolia logoinstantsearch

⚡️ Libraries for building performant and instant search and recommend experiences with Algolia. Compatible with JavaScript, TypeScript, React and Vue.

3,862
539
3,862
159

Top Related Projects

Search UI. Libraries for the fast development of modern, engaging search experiences.

React + Vue Search UI for Elasticsearch & Opensearch. Compatible with Algolia's Instantsearch and Autocomplete components.

Next-Generation full text search library for Browser and Node.js

JS Search is an efficient, client-side search library for JavaScript and JSON objects

Fast SublimeText-like fuzzy search for JavaScript.

18,934

Lightweight fuzzy-search, in JavaScript

Quick Overview

Algolia InstantSearch is a library of UI components and helpers designed to build instant search experiences. It provides a set of widgets to create search interfaces quickly and easily, with support for various frameworks including vanilla JavaScript, React, Vue, and Angular.

Pros

  • Easy to set up and integrate with existing Algolia search implementations
  • Highly customizable with a wide range of pre-built widgets and components
  • Supports multiple frontend frameworks and vanilla JavaScript
  • Excellent documentation and community support

Cons

  • Requires an Algolia account and backend setup to function
  • Learning curve for advanced customizations and complex search scenarios
  • Some features may require higher-tier Algolia plans
  • Performance can be impacted if not optimized properly for large datasets

Code Examples

  1. Basic InstantSearch setup:
import algoliasearch from 'algoliasearch/lite';
import instantsearch from 'instantsearch.js';
import { searchBox, hits } from 'instantsearch.js/es/widgets';

const searchClient = algoliasearch('YOUR_APP_ID', 'YOUR_SEARCH_API_KEY');

const search = instantsearch({
  indexName: 'YOUR_INDEX_NAME',
  searchClient,
});

search.addWidgets([
  searchBox({
    container: '#searchbox',
  }),
  hits({
    container: '#hits',
  }),
]);

search.start();
  1. Adding a refinement list:
import { refinementList } from 'instantsearch.js/es/widgets';

search.addWidgets([
  refinementList({
    container: '#brand-list',
    attribute: 'brand',
  }),
]);
  1. Custom hit template:
import { hits } from 'instantsearch.js/es/widgets';

search.addWidgets([
  hits({
    container: '#hits',
    templates: {
      item: (hit, { html, components }) => html`
        <div>
          <img src="${hit.image}" alt="${hit.name}" />
          <h2>${components.Highlight({ hit, attribute: 'name' })}</h2>
          <p>$${hit.price}</p>
        </div>
      `,
    },
  }),
]);

Getting Started

  1. Install InstantSearch:

    npm install instantsearch.js algoliasearch
    
  2. Set up your HTML:

    <div id="searchbox"></div>
    <div id="hits"></div>
    
  3. Initialize InstantSearch (see the first code example above)

  4. Add desired widgets and customize as needed

  5. Call search.start() to render the search interface

Competitor Comparisons

Search UI. Libraries for the fast development of modern, engaging search experiences.

Pros of Search UI

  • Designed specifically for Elasticsearch, offering deep integration and advanced features
  • More flexible and customizable, allowing for complex search experiences
  • Supports multiple backend search engines, not limited to Elasticsearch

Cons of Search UI

  • Smaller community and ecosystem compared to InstantSearch
  • Steeper learning curve, especially for developers new to Elasticsearch
  • Less comprehensive documentation and fewer ready-to-use UI components

Code Comparison

InstantSearch (JavaScript):

import { instantsearch } from 'instantsearch.js';
import { searchBox, hits } from 'instantsearch.js/es/widgets';

const search = instantsearch({
  indexName: 'your_index_name',
  searchClient: algoliasearch('your_app_id', 'your_search_key'),
});

Search UI (JavaScript):

import { SearchProvider, SearchBox, Results } from "@elastic/react-search-ui";
import { SearchDriver } from "@elastic/search-ui";

const config = {
  apiConnector: new ElasticsearchAPIConnector({
    host: "http://localhost:9200",
    index: "your_index_name"
  }),
  searchQuery: {
    search_fields: { title: {} }
  }
};

Both libraries offer declarative ways to create search interfaces, but Search UI provides more flexibility for complex Elasticsearch queries and configurations. InstantSearch has a simpler setup process and is more opinionated in its approach, which can lead to faster development for straightforward use cases.

React + Vue Search UI for Elasticsearch & Opensearch. Compatible with Algolia's Instantsearch and Autocomplete components.

Pros of Searchkit

  • Open-source and free to use, with no usage limits or costs
  • Highly customizable and flexible, allowing for deep integration with existing React applications
  • Supports multiple search backends, including Elasticsearch and OpenSearch

Cons of Searchkit

  • Smaller community and ecosystem compared to Instantsearch
  • Less out-of-the-box UI components, requiring more custom development
  • Steeper learning curve for developers new to Elasticsearch or OpenSearch

Code Comparison

Searchkit:

import { SearchkitProvider, SearchBox, Hits } from '@searchkit/react'

const App = () => (
  <SearchkitProvider>
    <SearchBox />
    <Hits />
  </SearchkitProvider>
)

Instantsearch:

import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-dom'

const App = () => (
  <InstantSearch indexName="your_index_name" searchClient={searchClient}>
    <SearchBox />
    <Hits />
  </InstantSearch>
)

Both libraries offer similar high-level components for basic search functionality. However, Instantsearch is more tightly coupled with Algolia's services, while Searchkit provides more flexibility in terms of backend integration. Searchkit requires more configuration for advanced features, whereas Instantsearch offers more pre-built components out of the box.

Next-Generation full text search library for Browser and Node.js

Pros of FlexSearch

  • Lightweight and fast: FlexSearch is designed for high performance and minimal footprint
  • Flexible and customizable: Offers various configuration options and search modes
  • Works in both browser and Node.js environments without dependencies

Cons of FlexSearch

  • Less comprehensive UI components compared to InstantSearch
  • Smaller community and ecosystem
  • Limited built-in integrations with other services

Code Comparison

InstantSearch (JavaScript):

const search = instantsearch({
  indexName: 'my_index',
  searchClient: algoliasearch('APP_ID', 'API_KEY'),
});

search.addWidgets([
  instantsearch.widgets.searchBox({
    container: '#searchbox',
  }),
  instantsearch.widgets.hits({
    container: '#hits',
  })
]);

search.start();

FlexSearch (JavaScript):

const index = new FlexSearch({
  encode: "icase",
  tokenize: "forward",
  threshold: 0,
  resolution: 9,
  depth: 4
});

index.add(1, "John Doe");
index.add(2, "Jane Doe");

const results = index.search("jo");

Both libraries offer search functionality, but InstantSearch provides a more comprehensive set of UI components and integrations with Algolia's services. FlexSearch, on the other hand, focuses on providing a lightweight and flexible search engine that can be easily customized and integrated into various applications.

JS Search is an efficient, client-side search library for JavaScript and JSON objects

Pros of js-search

  • Lightweight and dependency-free, making it easier to integrate into projects
  • Supports client-side search without relying on external services
  • Flexible and customizable search options, including fuzzy matching and stemming

Cons of js-search

  • Limited built-in UI components compared to InstantSearch
  • Lacks advanced features like faceted search and analytics
  • May require more manual configuration for complex search scenarios

Code Comparison

InstantSearch (React):

import { InstantSearch, SearchBox, Hits } from 'react-instantsearch-dom';

<InstantSearch indexName="your_index" searchClient={searchClient}>
  <SearchBox />
  <Hits />
</InstantSearch>

js-search:

import * as JsSearch from 'js-search';

const search = new JsSearch.Search('id');
search.addIndex('title');
search.addDocuments(data);
const results = search.search('query');

InstantSearch provides a more declarative approach with pre-built UI components, while js-search offers a lower-level API for custom implementations. InstantSearch is better suited for larger projects with complex search requirements, whereas js-search is ideal for simpler, client-side search functionality in smaller applications or when working offline.

Fast SublimeText-like fuzzy search for JavaScript.

Pros of fuzzysort

  • Lightweight and focused on fuzzy searching functionality
  • Simple to integrate with minimal dependencies
  • Highly performant for client-side fuzzy searching

Cons of fuzzysort

  • Limited to fuzzy searching, lacks comprehensive search UI components
  • Requires more custom development for advanced search features
  • Less suitable for large-scale, server-side search implementations

Code Comparison

fuzzysort:

import fuzzysort from 'fuzzysort'

const results = fuzzysort.go('qck', ['quick', 'brown', 'fox'])
console.log(results[0].target) // 'quick'

InstantSearch:

import instantsearch from 'instantsearch.js'
import { searchBox, hits } from 'instantsearch.js/es/widgets'

const search = instantsearch({
  indexName: 'your_index_name',
  searchClient: algoliasearch('app_id', 'api_key'),
})

search.addWidgets([
  searchBox({ container: '#searchbox' }),
  hits({ container: '#hits' })
])

Summary

fuzzysort is a lightweight, client-side fuzzy search library focused on performance and simplicity. It's ideal for small to medium-sized datasets and quick integration. InstantSearch, on the other hand, is a comprehensive search UI library that provides ready-to-use widgets and connects to Algolia's powerful search engine. It's better suited for large-scale applications with complex search requirements and server-side processing.

18,934

Lightweight fuzzy-search, in JavaScript

Pros of Fuse

  • Lightweight and dependency-free, making it easy to integrate into projects
  • Offers fuzzy-search capabilities, allowing for more flexible matching
  • Can be used client-side or server-side, providing versatility in implementation

Cons of Fuse

  • Limited built-in UI components compared to InstantSearch
  • Lacks advanced features like faceted search and pagination out of the box
  • May require more custom development for complex search implementations

Code Comparison

Fuse:

const fuse = new Fuse(list, options)
const result = fuse.search('query')

InstantSearch:

const search = instantsearch({
  indexName: 'your_index_name',
  searchClient: algoliasearch('app_id', 'api_key'),
});
search.addWidgets([
  instantsearch.widgets.searchBox({
    container: '#searchbox',
  }),
]);
search.start();

Fuse is more straightforward for basic search functionality, while InstantSearch provides a more comprehensive solution with pre-built UI components and integration with Algolia's search engine. Fuse is ideal for smaller projects or when custom search logic is needed, whereas InstantSearch shines in larger applications requiring advanced search features and scalability.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

InstantSearch.js

InstantSearch is a JavaScript library for building performant and instant search experiences in vanilla JS, React and Vue with Algolia.


License Build Status

InstantSearch is a JavaScript library that lets you create an instant-search result experience using Algolia’s search API.

There are multiple wrappers for popular frameworks, such as React InstantSearch and Vue InstantSearch.

It is part of the InstantSearch family which is designed for different platforms:

InstantSearch | InstantSearch Android | InstantSearch iOS

Table of contents

Packages

PackageVersionDescription
algoliasearch-helperalgoliasearch-helper npm versionHelper for implementing advanced search features with Algolia
create-instantsearch-appcreate-instantsearch-app npm versionCommand-line utility to quickly bootstrap a project with InstantSearch
instantsearch.cssinstantsearch.css npm versionDefault CSS themes for InstantSearch
instantsearch.jsinstantsearch.js npm versionInstantSearch.js
react-instantsearchreact-instantsearch npm versionReact InstantSearch bundled library
react-instantsearch-corereact-instantsearch-core npm versionRuntime-independent React InstantSearch version
vue-instantsearchvue-instantsearch npm versionVue InstantSearch

Contributing

We welcome all contributors, from casual to regular 💙

  • Bug report. Is something not working as expected? Send a bug report.
  • Feature request. Would you like to add something to the library? Send a feature request.
  • Documentation. Did you find a typo in the doc? Open an issue and we'll take care of it.
  • Development. If you don't know where to start, you can check the open issues that are tagged easy, the bugs or chores.

To start contributing to code, you need to:

  1. Fork the project
  2. Clone the repository
  3. Install the dependencies: yarn
  4. Pick a package to work on and cd into it (e.g. cd packages/react-instantsearch)

Please read our contribution process to learn more.

License

InstantSearch is MIT licensed.

NPM DownloadsLast 30 Days