-
Notifications
You must be signed in to change notification settings - Fork 531
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(disjunctive): prefer values of main query for facet count (#6445)
* fix(disjunctive): prefer values of main query for facet count This is relevant in two cases: - second query is non-exhaustive - second query is not correct due to facet count after distinct There's still more edge cases left (first query non exhaustive, but second isn't, but that's unlikely) and those are not worse after this PR. * Update packages/algoliasearch-helper/test/spec/SearchResults/getFacetValues.js * same for hierarchical * fix, but only when persistHierarchicalRootCount is true --------- Co-authored-by: Dhaya <[email protected]>
- Loading branch information
Showing
6 changed files
with
248 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...goliasearch-helper/test/spec/SearchResults/getFacetValues/disjunctive-non-exhaustive.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"content": { | ||
"results": [ | ||
{ | ||
"hits": [], | ||
"nbHits": 1000, | ||
"page": 0, | ||
"nbPages": 20, | ||
"hitsPerPage": 0, | ||
"processingTimeMS": 1, | ||
"facets": { | ||
"brand": { | ||
"Apple": 1000 | ||
} | ||
}, | ||
"exhaustiveFacetsCount": true, | ||
"query": "", | ||
"params": "query=&maxValuesPerFacet=3&page=0&facets=%5B%22brand%22%5D&tagFilters=&facetFilters=%5B%5B%22brand%3AApple%22%5D%5D", | ||
"index": "instant_search" | ||
}, | ||
{ | ||
"hits": [ | ||
{ | ||
"objectID": "1696302" | ||
} | ||
], | ||
"nbHits": 10000, | ||
"page": 0, | ||
"nbPages": 1000, | ||
"hitsPerPage": 1, | ||
"processingTimeMS": 1, | ||
"facets": { | ||
"brand": { | ||
"Insignia™": 551, | ||
"Samsung": 511, | ||
"Apple": 1 | ||
} | ||
}, | ||
"exhaustiveFacetsCount": false, | ||
"query": "", | ||
"params": "query=&maxValuesPerFacet=3&page=0&hitsPerPage=1&attributesToRetrieve=%5B%5D&attributesToHighlight=%5B%5D&attributesToSnippet=%5B%5D&tagFilters=&facets=brand", | ||
"index": "instant_search" | ||
} | ||
] | ||
}, | ||
"state": { | ||
"index": "instant_search", | ||
"query": "", | ||
"facets": [], | ||
"disjunctiveFacets": ["brand"], | ||
"hierarchicalFacets": [], | ||
"facetsRefinements": {}, | ||
"facetsExcludes": {}, | ||
"disjunctiveFacetsRefinements": { | ||
"brand": ["Apple"] | ||
}, | ||
"numericRefinements": {}, | ||
"tagRefinements": [], | ||
"hierarchicalFacetsRefinements": {}, | ||
"maxValuesPerFacet": 3, | ||
"page": 0 | ||
}, | ||
"error": null | ||
} |
63 changes: 63 additions & 0 deletions
63
...oliasearch-helper/test/spec/SearchResults/getFacetValues/hierarchical-non-exhaustive.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"content": { | ||
"results": [ | ||
{ | ||
"hits": [], | ||
"nbHits": 1000, | ||
"page": 0, | ||
"nbPages": 16, | ||
"hitsPerPage": 8, | ||
"facets": { | ||
"brand": { | ||
"Apple": 1000 | ||
} | ||
}, | ||
"exhaustiveFacetsCount": true, | ||
"exhaustiveNbHits": true, | ||
"query": "", | ||
"index": "instant_search" | ||
}, | ||
{ | ||
"hits": [], | ||
"nbHits": 3988, | ||
"page": 0, | ||
"nbPages": 0, | ||
"hitsPerPage": 0, | ||
"facets": { | ||
"brand": { | ||
"Apple": 50, | ||
"Insignia™": 551, | ||
"Samsung": 551 | ||
} | ||
}, | ||
"exhaustiveFacetsCount": true, | ||
"exhaustiveNbHits": true, | ||
"query": "", | ||
"index": "instant_search" | ||
} | ||
] | ||
}, | ||
"state": { | ||
"index": "instant_search", | ||
"query": "", | ||
"facets": [], | ||
"disjunctiveFacets": [], | ||
"hierarchicalFacets": [ | ||
{ | ||
"name": "brand", | ||
"attributes": ["brand"] | ||
} | ||
], | ||
"facetsRefinements": {}, | ||
"facetsExcludes": {}, | ||
"disjunctiveFacetsRefinements": {}, | ||
"numericRefinements": {}, | ||
"tagRefinements": [], | ||
"hierarchicalFacetsRefinements": { | ||
"brand": ["Apple"] | ||
}, | ||
"maxValuesPerFacet": 3, | ||
"page": 0 | ||
}, | ||
"error": null | ||
} |