C# (CSharp) Lucene.Net.Spatial.Prefix Namespace

Nested Namespaces

Lucene.Net.Spatial.Prefix.Tree

Classes

Name Description
AbstractPrefixTreeFilter Base class for Lucene Filters on SpatialPrefixTree fields. @lucene.experimental
AbstractPrefixTreeFilter.BaseTermsEnumTraverser Holds transient state and docid collecting utility methods as part of traversing a Lucene.Net.Index.TermsEnum.
IntersectsPrefixTreeFilter A Filter matching documents that have an SpatialRelation.Intersects (i.e. not DISTINCT) relationship with a provided query shape.
IntersectsPrefixTreeFilter._VisitorTemplate_55
NtsPolygonTest
PrefixCellsTokenizer
PrefixTreeStrategy An abstract SpatialStrategy based on Lucene.Net.Spatial.Prefix.Tree.SpatialPrefixTree . The two subclasses are RecursivePrefixTreeStrategy and TermQueryPrefixTreeStrategy . This strategy is most effective as a fast approximate spatial search filter.

Characteristics:

  • Can index any shape; however only RecursivePrefixTreeStrategy can effectively search non-point shapes.
  • Can index a variable number of shapes per field value. This strategy can do it via multiple calls to CreateIndexableFields(Shape) for a document or by giving it some sort of Shape aggregate (e.g. JTS WKT MultiPoint). The shape's boundary is approximated to a grid precision.
  • Can query with any shape. The shape's boundary is approximated to a grid precision.
  • Only Lucene.Net.Spatial.Query.SpatialOperation.Intersects is supported. If only points are indexed then this is effectively equivalent to IsWithin.
  • The strategy supports MakeDistanceValueSource(Point) even for multi-valued data, so long as the indexed data is all points; the behavior is undefined otherwise. However, it will likely be removed in the future in lieu of using another strategy with a more scalable implementation. Use of this call is the only circumstance in which a cache is used. The cache is simple but as such it doesn't scale to large numbers of points nor is it real-time-search friendly.

Implementation:

The Lucene.Net.Spatial.Prefix.Tree.SpatialPrefixTree does most of the work, for example returning a list of terms representing grids of various sizes for a supplied shape. An important configuration item is SetDistErrPct(double) which balances shape precision against scalability. See those javadocs.
PrefixTreeStrategy.CellTokenStream Outputs the tokenString of a cell, and if its a leaf, outputs it again with the leaf byte.
RecursivePrefixTreeFilter Performs a spatial intersection filter against a field indexed with {@link SpatialPrefixTree}, a Trie. SPT yields terms (grids) at length 1 and at greater lengths corresponding to greater precisions. This filter recursively traverses each grid length and uses methods on {@link Shape} to efficiently know that all points at a prefix fit in the shape or not to either short-circuit unnecessary traversals or to efficiently load all enclosed points.
RecursivePrefixTreeStrategy A PrefixTreeStrategy which uses AbstractVisitingPrefixTreeFilter. This strategy has support for searching non-point shapes (note: not tested). Even a query shape with distErrPct=0 (fully precise to the grid) should have good performance for typical data, unless there is a lot of indexed data coincident with the shape's edge. @lucene.experimental
SpatialOpRecursivePrefixTreeTest
SpatialOpRecursivePrefixTreeTest.FakeSpatialContextFactory LUCENENET specific class used to gain access to protected internal member NewSpatialContext(), since we are not strong-named and InternalsVisibleTo is not an option from a strong-named class.
SpatialOpRecursivePrefixTreeTest.ShapePair
TermQueryPrefixTreeStrategy A basic implementation using a large {@link TermsFilter} of all the nodes from {@link SpatialPrefixTree#getNodes(com.spatial4j.core.shape.Shape, int, boolean)}.
TestRecursivePrefixTreeStrategy
TestTermQueryPrefixGridStrategy
WithinPrefixTreeFilter Finds docs where its indexed shape is WITHIN the query shape. It works by looking at cells outside of the query shape to ensure documents there are excluded. By default, it will examine all cells, and it's fairly slow. If you know that the indexed shapes are never comprised of multiple disjoint parts (which also means it is not multi-valued), then you can pass SpatialPrefixTree.getDistanceForLevel(maxLevels) as the queryBuffer constructor parameter to minimally look this distance beyond the query shape's edge. Even if the indexed shapes are sometimes comprised of multiple disjoint parts, you might want to use this option with a large buffer as a faster approximation with minimal false-positives.
WithinPrefixTreeFilter._VisitorTemplate_121