Icon searching white

Search Overview

Last updated 03 July 2017

Out of the Box Relevance

Algolia comes with built in textual relevance that requires very little fine-tuning to work well for the vast majority of use cases. All that is required on your end is to define two main parameters: your searchableAttributes and customRanking. Our Ranking Formula Guide and Relevance Overview Guide dive deeper into these concepts.

Basic Queries

To retrieve results from Algolia, you will need to leverage the Search an index method. Querying Algolia involves defining:

  • the index against which you are querying
  • a query string
  • optional parameters

Optional parameters can alter textual relevance behavior at query-time, potentially overriding index-level settings. For example, it’s possible to define stop words or change plurals behavior only for certain queries.

We recommend querying Algolia directly from the end user’s browser, mobile device, or client to ensure optimal performance by reducing latency (and giving you the benefit of offloading your servers!).

Here’s a basic query example:

index.search({
    query: 'query',
    ignorePlurals: true
});

Empty Queries

In some cases, you might not need to pass in a textual query. It’s possible to retrieve results from Algolia simply by specifying an index, and other optional parameters (most likely, a filter). In this way, it’s possible to use Algolia beyond a standard “search results” experience. For example, one common use case is to leverage filtering capabilities to generate category landing pages.

Response Format

If a query is successful, your request will generate a JSON response in return. This response contains both the matching results (“hits”) as well as other information useful for building a full-fledged search experience (for example: facets, highlighting, hits count, and more).

Check out our Building a Search UI Guide for a deeper look into the response’s content.

What’s Next

Continue building your Algolia knowledge with these concepts:

If you want to get started building your search UI, we have a few tutorials you might find helpful:

© Algolia - Privacy Policy