What is @algolia/client-search?
The @algolia/client-search npm package is designed to facilitate seamless integration with Algolia's search API, enabling developers to easily implement search functionality within their applications. It provides a comprehensive set of features for indexing and querying searchable data, managing indices, and configuring search parameters for optimized search experiences.
What are @algolia/client-search's main functionalities?
Search in an index
This feature allows you to perform a search query on a specific index. The search results are returned as 'hits'.
{"searchIndex.search('query').then(({ hits }) => console.log(hits));"}
Save objects to an index
This feature enables you to save objects to an index, which can then be searched. Objects must have an 'objectID' or it can be auto-generated.
{"index.saveObjects([{ objectID: '1', name: 'John Doe' }], { autoGenerateObjectIDIfNotExist: true }).then(({ objectIDs }) => console.log(objectIDs));"}
Configure index settings
This feature allows you to configure various settings for an index, such as defining which attributes are searchable.
{"index.setSettings({ searchableAttributes: ['name', 'email'] }).then(() => console.log('Settings updated'));"}
Other packages similar to @algolia/client-search
elasticsearch
Elasticsearch is a distributed, RESTful search and analytics engine capable of addressing a growing number of use cases. While @algolia/client-search is specifically designed for integration with Algolia's managed search services, Elasticsearch offers a more flexible, self-hosted solution that requires manual setup and management.
solr-node
solr-node is a client library for interacting with Apache Solr, a powerful open-source search platform. Similar to Elasticsearch, Solr provides extensive search capabilities but requires self-hosting and management. Compared to @algolia/client-search, solr-node targets users who prefer or require more control over their search infrastructure.
The perfect starting point to integrate Algolia within your JavaScript project
Documentation •
InstantSearch •
Community Forum •
Stack Overflow •
Report a bug •
FAQ •
Support
✨ Features
- Thin & minimal low-level HTTP client to interact with Algolia's API
- Works both on the browser and node.js
- UMD and ESM compatible, you can use it with any module loader
- Built with TypeScript
💡 Getting Started
[!TIP]
This API client is already a dependency of the algoliasearch client, you don't need to manually install @algolia/client-search
if you already have algoliasearch
installed.
To get started, you first need to install @algolia/client-search (or any other available API client package).
All of our clients comes with type definition, and are available for both browser and node environments.
With a package manager
yarn add @algolia/client-search@5.17.0
npm install @algolia/client-search@5.17.0
pnpm add @algolia/client-search@5.17.0
Without a package manager
Add the following JavaScript snippet to the of your website:
<script src="https://cdn.jsdelivr.net/npm/@algolia/client-search@5.17.0/dist/builds/browser.umd.js"></script>
Usage
You can now import the Algolia API client in your project and play with it.
import { searchClient } from '@algolia/client-search';
const client = searchClient('YOUR_APP_ID', 'YOUR_API_KEY');
For full documentation, visit the Algolia JavaScript API Client.
❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our FAQ where you will find answers for the most common issues and gotchas with the client. You can also open a GitHub issue
📄 License
The Algolia JavaScript API Client is an open-sourced software licensed under the MIT license.