Guides / Getting started

Get started with NeuralSearch

NeuralSearch combines the precision of keyword search with the deep understanding of natural language and contextual relevance provided by AI-based vector search. On every keystroke, NeuralSearch performs a hybrid keyword and vector search, merges the results, and ranks them based on relevance so that searchers get fast and accurate results that align with their search intent.

Explore related videos in the Algolia Academy

Before you begin

NeuralSearch has the following requirements:

Set up NeuralSearch

You can activate NeuralSearch on an index in your Algolia dashboard:

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Search.
  3. Select your Algolia index:

    Select your Algolia application and index

  4. Go to Configure > NeuralSearch and click Configure NeuralSearch.

  5. Select your event source. By default, NeuralSearch uses events from the index you selected to train the language model. If your index has replicas, you can add them as additional event sources. Click Add event sources to add these event source indices.

  6. If you collected enough events in the last 30 days, you can select one of these options:

    • Select Activate NeuralSearch to start the training and activate NeuralSearch for the current index.
    • Select See NeuralSearch in action to create a replica index where you can test NeuralSearch.

    Both options are inactive until you collect enough events.

Building the NeuralSearch index takes time, depending on your index size.

Search with NeuralSearch

Searching with NeuralSearch works the same as before, except with an increased understanding of the query. Now, instead of matching only keywords in the text, the search engine also returns results that match concepts:

  Keyword search NeuralSearch
Matches Keywords Concepts and keywords
Results Exact or similar keyword matches Relevant results, even if the query doesn’t match keywords
Understanding of user intent Limited Can anticipate intent based on the search

Set the search mode in the API

After activating NeuralSearch in the dashboard, you can use the mode API parameter to turn NeuralSearch off:

1
$index->setSettings(['mode' => 'keywordSearch']);

To re-activate NeuralSearch for the current index:

1
$index->setSettings(['mode' => 'neuralSearch']);

How NeuralSearch ranks results

NeuralSearch results have a neural score composed of a keyword score, a semantic score, or both.

Keyword score

The keyword score represents how well a record matches the query from a keyword search against other keyword-retrieved results. At the base of this score is Algolia’s tie-breaking algorithm. A record has a keyword score if a keyword search finds it.

Semantic score

The semantic score represents how well a record matches the query from a vector search against other vector-retrieved results. The basis of this score is neural hash similarity. A record has a semantic score if a vector search finds it.

Neural score

The neural score combines the keyword score and the semantic score. It measures how relevant the record is compared to the other records in the result set. The neural score answers the question: “Against this query, compared to these other results, how relevant is this result?”

Did you find this page helpful?