Package org.apache.lucene.spatial.prefix
Class HeatmapFacetCounter
- java.lang.Object
-
- org.apache.lucene.spatial.prefix.HeatmapFacetCounter
-
public class HeatmapFacetCounter extends Object
Computes spatial facets in two dimensions as a grid of numbers. The data is often visualized as a so-called "heatmap", hence the name.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HeatmapFacetCounter.Heatmap
Response structure
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_ROWS_OR_COLUMNS
Maximum number of supported rows (or columns).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static HeatmapFacetCounter.Heatmap
calcFacets(PrefixTreeStrategy strategy, IndexReaderContext context, Bits topAcceptDocs, org.locationtech.spatial4j.shape.Shape inputShape, int facetLevel, int maxCells)
Calculates spatial 2D facets (aggregated counts) in a grid, sometimes called a heatmap.
-
-
-
Method Detail
-
calcFacets
public static HeatmapFacetCounter.Heatmap calcFacets(PrefixTreeStrategy strategy, IndexReaderContext context, Bits topAcceptDocs, org.locationtech.spatial4j.shape.Shape inputShape, int facetLevel, int maxCells) throws IOException
Calculates spatial 2D facets (aggregated counts) in a grid, sometimes called a heatmap. Facet computation is implemented by navigating the underlying indexed terms efficiently. If you don't know exactly what facetLevel to go to for a given input box but you have some sense of how many cells there should be relative to the size of the shape, then consider using the logic thatPrefixTreeStrategy
uses when approximating what level to go to when indexing a shape given a distErrPct.- Parameters:
context
- the IndexReader's contexttopAcceptDocs
- a Bits to limit counted docs. If null, live docs are counted.inputShape
- the shape to gather grid squares for; typically aRectangle
. The actual heatmap area will usually be larger since the cells on the edge that overlap are returned. We always return a rectangle of integers even if the inputShape isn't a rectangle -- the non-intersecting cells will all be 0. If null is given, the entire world is assumed.facetLevel
- the target depth (detail) of cells.maxCells
- the maximum number of cells to return. If the cells exceed this count, an- Throws:
IOException
-
-