public class PrefixTreeFacetCounter extends Object
PrefixTreeStrategy
.
NOTE: If for a given document and a given field using
RecursivePrefixTreeStrategy
multiple values are indexed (i.e. multi-valued) and at least one of them is a non-point, then there is a possibility
of double-counting the document in the facet results. Since each shape is independently turned into grid cells at
a resolution chosen by the shape's size, it's possible they will be indexed at different resolutions. This means
the document could be present in BOTH the postings for a cell in both its prefix and leaf variants. To avoid this,
use a single valued field with a ShapeCollection
(or WKT equivalent). Or
calculate a suitable level/distErr to index both and call
PrefixTreeStrategy.createIndexableFields(org.locationtech.spatial4j.shape.Shape, int)
with the same value for all shapes for a given document/field.
Modifier and Type | Class and Description |
---|---|
static class |
PrefixTreeFacetCounter.FacetVisitor
A callback/visitor of facet counts.
|
Modifier and Type | Method and Description |
---|---|
static void |
compute(PrefixTreeStrategy strategy,
IndexReaderContext context,
Bits topAcceptDocs,
org.locationtech.spatial4j.shape.Shape queryShape,
int facetLevel,
PrefixTreeFacetCounter.FacetVisitor facetVisitor)
Computes facets using a callback/visitor style design, allowing flexibility for the caller to determine what to do
with each underlying count.
|
static void |
compute(PrefixTreeStrategy strategy,
LeafReaderContext context,
Bits acceptDocs,
org.locationtech.spatial4j.shape.Shape queryShape,
int facetLevel,
PrefixTreeFacetCounter.FacetVisitor facetVisitor)
Lower-level per-leaf segment method.
|
public static void compute(PrefixTreeStrategy strategy, IndexReaderContext context, Bits topAcceptDocs, org.locationtech.spatial4j.shape.Shape queryShape, int facetLevel, PrefixTreeFacetCounter.FacetVisitor facetVisitor) throws IOException
strategy
- the prefix tree strategy (contains the field reference, grid, max levels)context
- the IndexReader's contexttopAcceptDocs
- a Bits to limit counted docs. If null, live docs are counted.queryShape
- the shape to limit the range of facet counts tofacetLevel
- the maximum depth (detail) of faceted cellsfacetVisitor
- the visitor/callback to receive the countsIOException
public static void compute(PrefixTreeStrategy strategy, LeafReaderContext context, Bits acceptDocs, org.locationtech.spatial4j.shape.Shape queryShape, int facetLevel, PrefixTreeFacetCounter.FacetVisitor facetVisitor) throws IOException
IOException
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.