🎉 Try the public beta of the new docs site at algolia.com/doc-beta! 🎉
API Reference / API Parameters / minProximity
Type: integer
Engine default: 1
Parameter syntax
'minProximity' => integer // From 1 to 7

Can be used in these methods:

About this parameter

Precision of the proximity ranking criterion.

Usage notes

The proximity ranking criterion measures how close together two matching words are in a search result.

The default value of minProximity is 1. This means that the two matching words are right next to each other. You can increase the minProximity value to as much as 7 so that words that are further apart have the same proximity score. For example, if you set minProximity to 2, the following phrases would have the same score:

  • JavaScript framework
  • JavaScript charting framework

The proximity ranking criterion is ignored if minProximity is higher than 7.

Examples

Set default min proximity

1
2
3
$index->setSettings([
  'minProximity' => 1
]);
1
2
3
$results = $index->search('query', [
  'minProximity' => 2
]);
Did you find this page helpful?