- Review your data.
- Verify that both searchable attributes and custom ranking are well configured.
- Take a look at your analytics data for insights into how to improve your data or settings.
- Review the troubleshooting guide for rules.
Search tweaks
If youâve gone through the preceding steps, check the following settings:- Override the default prefix setting
- Allow users to use quotes and negative query terms
- Enable search on some non-alphanumeric characters
- Override the default ranking formula
- Make the Words criterion first in the list
- Adjust the Exact criterion
- Adjust the Proximity criterion
Adjust prefix search
Prefix matching is central to Algoliaâs as-you-type search experience. It lets Algolia match based on partial words. For example, as soon as a user typesa, ap, apr,
any records containing apricot will be returned.
Algolia doesnât wait for a full-word match before displaying results.
By default, only the last word in a query is treated as a prefix:
all other text in the query must be a complete match.
You can change this and get more results by making all text in a query match the prefix.
For more information, see:
Advanced syntax
When Algoliaâs advanced syntax is enabled, search queries are treated differently in two significant ways.Match phrases within quotes
Terms in quotes must match exactly. For example,sparkly blue "iPhone case" only returns records containing the exact string,
âiPhone caseâ but âsparklyâ and âblueâ could occur anywhere in the record.
Algoliaâs typo tolerance is turned off inside quotes.
Exclude words from search
To exclude a word from a search, prefix it with a minus sign. For example,search -engine only matches records that contain âsearchâ but not âengine.â
Enable search on non-alphanumeric characters
By default, separators such as!, #, (, ), [, ], {, }, *, +, -, _, ä¸, ,, :, ;,
<, >, ?, @, /, \, ^, |, %, \``, &,~,ÂŁ,ÂĽ,§,âŹ,â,â,â , orâĄ` arenât indexed.
For example, the query âyahoo!â becomes âyahooâ.
To ensure that you can search for terms like âGoogle+â or âC#â,
you must override the default and ensure that + and # are treated like alphanumeric characters.
You can do that with the separatorsToIndex setting.
Change the ranking formula criteria
Donât change the default ranking formula unless you understand the global impact of the change. While changing the ranking formula might solve some queries, it might cause unexpected consequences for all others.Make Words the first ranking formula criterion
The most common change, and least risky, is to put the Words criterion as the first entry in the ranking formula. Moving the criterion is often done when dealing with long documents and queries, where you care about how many words match. The more words match, the more likely the document is relevant. This works in connection withoptionalWords.
Adjust the Exact criterion
The Exact criterion behaves like a counter: if an exact match occurs in an attribute, the Exact counter is incremented by 1. The higher the Exact count, the higher the record is ranked.- An exact match is where a complete word in a query matches fully without typos to a word in an attribute.
-
An inexact match is one with typos or matched by a prefix.
- âstarâ is an exact match to âStar Warsâ.
- âStaâ is an inexact match to âStar Warsâ
- Single-word matches on single-word attributes rank higher than multi-word exact matching.
Adjust the Proximity criterion
By default:- Adjacent words rank higher than words with one word between them
- Words with one word between them rank higher than words with two words between them, and so on
Large attributes affect proximity
If you have attributes of more than 1,000 words, Algolia assigns all matched words after the 1,000th a proximity score of 8 (the lowest). If you have such large attributes, you should split them into smaller components. To adjust the minimum proximity score, use theminProximity setting.