API Reference / API Parameters / minProximity
Jan. 14, 2019
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 minimum (and best) proximity value between two matching words is 1. This is the engine default.

  • Setting it to 2 (respectively N) would allow 1 (respectively N-1) additional word(s) to be found between two matching words without degrading the proximity ranking value.

  • For example, consider the query “javascript framework”. If you set minProximity to 2, two records containing respectively “JavaScript framework” and “JavaScript charting framework” will get the same proximity score, even if the latter contains an additional word between the two matching words.

  • The maximum value for minProximity is 7. Any higher value will disable the proximity criterion in the ranking formula.

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?