> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Override Algolia defaults

> Override Algolia defaults in rare or complex situations.

export const Records = () => <Tooltip tip="A record is a searchable object in an Algolia index. Each record consists of named attributes." cta="Algolia records" href="/doc/guides/sending-and-managing-data/prepare-your-data#algolia-records">
    records
  </Tooltip>;

**Don't override Algolia search defaults unless necessary.**
If your results aren't quite right,
before tweaking Algolia in an attempt to fix the problem,
first perform these steps:

* Review your data.
* Verify that both [searchable attributes](/doc/guides/managing-results/must-do/searchable-attributes) and [custom ranking](/doc/guides/managing-results/must-do/custom-ranking) are well configured.
* Take a look at your [analytics data](/doc/guides/search-analytics/concepts/metrics) for insights into how to improve your data or settings.
* Review the [troubleshooting guide](/doc/guides/managing-results/rules/merchandising-and-promoting) for rules.

## Search tweaks

If you've gone through the preceding steps,
check the following settings:

* [Override the default prefix setting](#adjust-prefix-search)
* [Allow users to use quotes and negative query terms](#advanced-syntax)
* [Enable search on some non-alphanumeric characters](#enable-search-on-non-alphanumeric-characters)
* [Override the default ranking formula](#change-the-ranking-formula-criteria)
* [Make the Words criterion first in the list](#make-words-the-first-ranking-formula-criterion)
* [Adjust the Exact criterion](#adjust-the-exact-criterion)
* [Adjust the Proximity criterion](#adjust-the-proximity-criterion)

These settings are global,
so you'll need to be careful since every change affects every search.
With a minor tweak, you may solve one problem but create others,
or worse, undermine your entire search solution.

### Adjust prefix search

Prefix matching is central to Algolia's as-you-type search experience.
It lets Algolia match <Records /> based on partial words.

For example, as soon as a user types `a`, `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:

* [Prefix search](/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/prefix-searching)
* [Empty or insufficient results](/doc/guides/managing-results/optimize-search-results/empty-or-insufficient-results)
* [Query in the middle of a word](/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/how-to/how-can-i-make-queries-within-the-middle-of-a-word)
* [`queryType`](/doc/api-reference/api-parameters/queryType) API parameter

### Advanced syntax

When Algolia's [advanced syntax](/doc/api-reference/api-parameters/advancedSyntax) 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.

<Info>
  [Algolia's typo tolerance](/doc/guides/managing-results/optimize-search-results/typo-tolerance/in-depth/configuring-typo-tolerance) is turned off inside quotes.
</Info>

#### 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`](/doc/api-reference/api-parameters/separatorsToIndex) setting.

### Change the ranking formula criteria

Don't change [the default ranking formula](/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria)
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](/doc/guides/managing-results/relevance-overview/in-depth/ranking-criteria#words-if-applicable) 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 with [`optionalWords`](/doc/api-reference/api-parameters/optionalWords).

### 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"

  Synonym matching and plural/singular matching are considered exact.

* **Single-word matches on single-word attributes rank higher than multi-word exact matching.**

You can [adjust one or more of these behaviors](/doc/guides/managing-results/optimize-search-results/override-search-engine-defaults/in-depth/adjust-exact-settings).

### 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

You can override this default behavior by increasing the minimum proximity up to 7.

For example, consider the query "javascript framework".
If you set minProximity to 2, two records containing "JavaScript framework" and "JavaScript charting framework" have the same proximity score.

#### 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](/doc/guides/sending-and-managing-data/prepare-your-data/how-to/indexing-long-documents).

To adjust the minimum proximity score, use the [`minProximity`](/doc/api-reference/api-parameters/minProximity) setting.
