Imagine the following index data with attributeForDistinct
set to supplierId
:
[
{
"supplierId": "supplier-A",
"companyCodeWithLabel": "Company 1",
"cpCodeWithLabel": "Code 1"
},
{
"supplierId": "supplier-A",
"companyCodeWithLabel": "Company 1",
"cpCodeWithLabel": "Code 2"
},
{
"supplierId": "supplier-A",
"companyCodeWithLabel": "Company 2",
"cpCodeWithLabel": "Code 3"
},
{
"supplierId": "supplier-B",
"companyCodeWithLabel": "Company 1",
"cpCodeWithLabel": "Code 1"
},
{
"supplierId": "supplier-B",
"companyCodeWithLabel": "Company 2",
"cpCodeWithLabel": "Code 4"
}
]
I want facet filter on companyCodeWithLabel
, so I’ve added it to attributesForFaceting
.
When searching for all records with distinct: true
I see the following refiner in Algolia dashboard:
Counters look a bit confusing for me, because:
- When I click on Company 1 (4) I actually get 2 records, Supplier A and Supplier B. So counter value 4 looks confusing for our users (although I understand that technically there are 4 records before distinct)
- But when I click on Company 2 (2) I actually get 2 records again, and things get more confusing as now counter value is correct
I’ve tried to set afterDistinctFlag to companyCodeWithLabel
facet, but in that case I do not see possible refiner values, (only Company 1, so users can’t refine by Company 2):
Is there any way to show correct refiner counts? I mean:
companyCodeWithLabel
Company 1 (2)
Company 2 (2)
So that counter value shows real number of records that user will get after clicking on refiner value.
Thanks in advance!