Support numeric facets
Author: rikvdhCreated Nov 4, 2017Updated May 21, 2025
Storing data as an int or uint and retrieving it later as facets gives odd results.
I have 212 documents in my index in this example with Brand.ID as the type uint. When JSON-encoding the facet it gives the following result:
{"field":"Brand.ID","total":3392,"missing":0,"other":1272,"terms":[{"term":" \u0001?x\u0000\u0000\u0000\u0000\u0000\u0000\u0000","count":212},{"term":"$\u000b@\u0000\u0000\u0000\u0000\u0000\u0000","count":212},{"term":"_|\u0000\u0000\u0000\u0000\u0000\u0000","count":212},{"term":",\u0005`\u0000\u0000\u0000\u0000\u0000","count":212},{"term":"0/~\u0000\u0000\u0000\u0000\u0000","count":212},{"term":"4\u0002p\u0000\u0000\u0000\u0000","cot":212},{"term":"8\u0017\u0000\u0000\u0000\u0000","count":212},{"term":"\u003c\u0001?x\u0000\u0000\u0000","count":212},{"term":"@\u000b@\u0000\u0000","count":212},{"term":"D_|\u0000\u0000","count":212}Looking at the code, the TermFacet struct doesn't account for the fact that Terms can have other types than string.
Is this intended behavior?
Source: blevesearch/bleve