3
votes

I'm looking into using Solr for a project where we have some specific faceting requirements. From what I've learned, Solr provides range-based facets, where Solr can provide facets of different value-ranges or date-ranges, e.i. field values are "grouped" and aggregated into different bins.

I would like to do something similar, but I want to create a custom function that maps field values to my specific facets, so that each field value is evaluated using a function to see which facet it belongs to. myFacet = myFacetMapper(fieldValue)

Its sort of a more advanced version of range-facets, but where values are mapped using a custom function rather than just into different bins.

Does anyone know if this is possible and where to start?

2

2 Answers

1
votes

I would look into using SimpleFacets to implement your logic. Then you embed it inside a SearchComponent, that you can register into your solrconfig. Look at the code of FacetComponent for an example.

1
votes

Create another field with value = myFacetMapper(field) , then do normal faceting on that field.