Socket
Socket
Sign inDemoInstall

@meilisearch/instant-meilisearch

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meilisearch/instant-meilisearch

The search client to use MeiliSearch with InstantSearch.


Version published
Weekly downloads
23K
increased by3.34%
Maintainers
2
Weekly downloads
 
Created
Source

Instant-MeiliSearch

Instant MeiliSearch

MeiliSearch | Website | Blog | Twitter | Documentation | FAQ

npm version Tests License Slack

⚡ How to integrate a front-end search bar in your website using MeiliSearch

MeiliSearch is a powerful, fast, open-source, easy to use and deploy search engine. Both searching and indexing are highly customizable. Features such as typo-tolerance, filters, and synonyms are provided out-of-the-box.

This library is a plugin to establish the communication between your MeiliSearch instance and the open-source InstantSearch tools (powered by Algolia) for your front-end application.

If you use React or Vue, you might want to check out these repositories:

NB: If you don't have any MeiliSearch instance running and containing your data, you should take a look at this getting started page.

Usage

Basic

const searchClient = instantMeiliSearch(
  "https://demos.meilisearch.com",
  "dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25"
);

Customization

const searchClient = instantMeiliSearch(
  "https://demos.meilisearch.com",
  "dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25",
  {
    hitsPerPage: 6, // default: 10
    limitPerRequest: 30 // default: 50
  }
);

Example with InstantSearch

The open-source InstantSearch library powered by Algolia provides all the front-end tools you need to highly customize your search bar environment.

In index.html:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
  </head>

  <body>
    <div>
      <h1>Enjoy searching with MeiliSearch!</h1>
      <div>
        <div id="searchbox"></div>
        <div id="hits"></div>
      </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/meilisearch/dist/bundles/meilisearch.browser.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script>
    <script src="./app.js"></script>
  </body>
</html>

In app.js:

const search = instantsearch({
  indexName: "codesandbox-IS",
  searchClient: instantMeiliSearch(
    "https://demos.meilisearch.com",
    "dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25",
  )
});

search.addWidgets([
  instantsearch.widgets.searchBox({
    container: "#searchbox"
  }),
  instantsearch.widgets.hits({
    container: "#hits",
    templates: {
      item: `
        <div>
          <div class="hit-name">
            {{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}}
          </div>
        </div>
      `
    }
  })
]);

search.start();

🚀 For a full getting started example, please take a look at this CodeSandbox:

Edit MS + IS

💡 If you have never used InstantSearch, we recommend reading this getting started documentation.

More Documentation

  • The open-source InstantSearch library is widely used and well documented in the Algolia documentation. It provides all the widgets to customize and improve your search bar environment in your website.
  • The MeiliSearch documentation.

Compatibility with MeiliSearch

This package is compatible with the following MeiliSearch versions:

  • v0.12.X

Development Workflow and Contributing

Any new contribution is more than welcome in this project!

If you want to know more about the development workflow or want to contribute, please visit our contributing guidelines for detailed instructions!


MeiliSearch provides and maintains many SDKs and Integration tools like this one. We want to provide everyone with an amazing search experience for any kind of project. If you want to contribute, make suggestions, or just know what's going on right now, visit us in the integration-guides repository.

Keywords

FAQs

Package last updated on 29 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc