Package org.apache.lucene.spatial.prefix

# Class TermQueryPrefixTreeStrategy

java.lang.Object
org.apache.lucene.spatial.SpatialStrategy
org.apache.lucene.spatial.prefix.PrefixTreeStrategy
org.apache.lucene.spatial.prefix.TermQueryPrefixTreeStrategy

public class TermQueryPrefixTreeStrategy extends PrefixTreeStrategy
A basic implementation of `PrefixTreeStrategy` using a large `TermInSetQuery` of all the cells from `SpatialPrefixTree.getTreeCellIterator(org.locationtech.spatial4j.shape.Shape, int)`. It only supports the search of indexed Point shapes.

The precision of query shapes (distErrPct) is an important factor in using this Strategy. If the precision is too precise then it will result in many terms which will amount to a slower query.

WARNING: This API is experimental and might change in incompatible ways in the next release.

## Nested Class Summary

## Nested classes/interfaces inherited from class org.apache.lucene.spatial.prefix.PrefixTreeStrategy

`PrefixTreeStrategy.ShapeTokenStream`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`simplifyIndexedCells`

### Fields inherited from class org.apache.lucene.spatial.prefix.PrefixTreeStrategy

`defaultFieldValuesArrayLen, distErrPct, FIELD_TYPE, grid, pointsOnly`

### Fields inherited from class org.apache.lucene.spatial.SpatialStrategy

`ctx`

## Constructor Summary

Constructors
Constructor
Description
`TermQueryPrefixTreeStrategy(SpatialPrefixTree grid, String fieldName)`

## Method Summary

Modifier and Type
Method
Description
`Query`
`makeQuery(SpatialArgs args)`
Make a Query based principally on `SpatialOperation` and `Shape` from the supplied `args`.
`protected CellToBytesRefIterator`
`newCellToBytesRefIterator()`

### Methods inherited from class org.apache.lucene.spatial.prefix.PrefixTreeStrategy

`calcFacets, createCellIteratorToIndex, createIndexableFields, createIndexableFields, createIndexableFields, getDistErrPct, getGrid, isPointShape, isPointsOnly, makeDistanceValueSource, setDefaultFieldValuesArrayLen, setDistErrPct, setPointsOnly, tokenStream`

### Methods inherited from class org.apache.lucene.spatial.SpatialStrategy

`getFieldName, getSpatialContext, makeDistanceValueSource, makeRecipDistanceValueSource, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### simplifyIndexedCells

protected boolean simplifyIndexedCells

## Constructor Details

### TermQueryPrefixTreeStrategy

public TermQueryPrefixTreeStrategy(SpatialPrefixTree grid, String fieldName)

## Method Details

### newCellToBytesRefIterator

protected CellToBytesRefIterator newCellToBytesRefIterator()

Overrides:
  `newCellToBytesRefIterator` in class `PrefixTreeStrategy`

### makeQuery

public Query makeQuery(SpatialArgs args)
Description copied from class: `SpatialStrategy`
Make a Query based principally on `SpatialOperation` and `Shape` from the supplied `args`. It should be constant scoring of 1.

Specified by:
  `makeQuery` in class `SpatialStrategy`