I am currently attempting to convert a custom Lucene collector to an
ElasticSearch facet. The facet is similar to a RangeFacet, but with
dynamic ranges. I have tried to use the existing RangeFacet and
HistogramFacet, but have not been able to create the a facet with a
fixed number of buckets and no predefined ranges.
From what I have gathered from viewing the source, these appear to be
the main steps (and questions) when creating a new facet:
Create a plugin that creates a new FacetProcessor (see below) to
add to the FacetModule.
Create a new FacetProcessor class. The types() and parse(...) are
pretty simple to understand. The reduce method is a bit trickier, but
I think I understand its usage. When/why do facets need to be merge?
Also, what is the purpose of the various regsiterStreams in the
Create a new FacetCollector class. The meat of the faceting
process. Contains the logic that creates the actual facets.
Create a new Facet class. Primarily a POJO.
Am I missing anything else? The process seems daunting, but hopefully
it will be alleviated since I should be able to build upon the
existing classes (skipping points 3 + 4). What the dynamic range
algorithm is actualy doing is executing a range facet on
pre-established static ranges (based on historical data) and then
combining those ranges evenly among a defined number of buckets.