attributeForDistinct
null
'attributeForDistinct' => 'attribute'
Can be used in these methods:
setSettings
set_settings
setSettings
set_settings
setSettings
setSettings
SetSettings
setSettings
SetSettings
setSettings
About this parameter
Name of the de-duplication attribute to be used with the distinct
feature.
Usage notes
- You can define only one attribute for distinct.
- You must define it at indexing time. You can’t define or override it at query time.
- Distinct values are expected to be strings or numbers:
- boolean or null values aren’t grouped.
- number values are rounded to the nearest integer and converted to their string representation, for example,
1
and1.2
both turn into"1"
. - string values are used as they are.
- array and object values aren’t supported and result in unspecified behavior.
Examples
Set the attribute to distinct on
1
2
3
$index->setSettings([
'attributeForDistinct' => 'url'
]);