use of org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy in project lucene-solr by apache.
the class CompositeStrategyTest method newRPT.
protected RecursivePrefixTreeStrategy newRPT() {
final RecursivePrefixTreeStrategy rpt = new RecursivePrefixTreeStrategy(this.grid, getClass().getSimpleName() + "_rpt");
//not too many cells
rpt.setDistErrPct(0.10);
return rpt;
}
use of org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy in project lucene-solr by apache.
the class PortedSolr3Test method parameters.
@ParametersFactory(argumentFormatting = "strategy=%s")
public static Iterable<Object[]> parameters() {
List<Object[]> ctorArgs = new ArrayList<>();
SpatialContext ctx = SpatialContext.GEO;
SpatialPrefixTree grid;
SpatialStrategy strategy;
grid = new GeohashPrefixTree(ctx, 12);
strategy = new RecursivePrefixTreeStrategy(grid, "recursive_geohash");
ctorArgs.add(new Object[] { strategy.getFieldName(), strategy });
grid = new QuadPrefixTree(ctx, 25);
strategy = new RecursivePrefixTreeStrategy(grid, "recursive_quad");
ctorArgs.add(new Object[] { strategy.getFieldName(), strategy });
grid = new GeohashPrefixTree(ctx, 12);
strategy = new TermQueryPrefixTreeStrategy(grid, "termquery_geohash");
ctorArgs.add(new Object[] { strategy.getFieldName(), strategy });
strategy = PointVectorStrategy.newInstance(ctx, "pointvector");
ctorArgs.add(new Object[] { strategy.getFieldName(), strategy });
strategy = PointVectorStrategy.newInstance(ctx, "pointvector_legacy");
ctorArgs.add(new Object[] { strategy.getFieldName(), strategy });
return ctorArgs;
}
use of org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy in project lucene-solr by apache.
the class QueryEqualsHashCodeTest method testEqualsHashCode.
@Test
public void testEqualsHashCode() {
switch(//0-3
random().nextInt(4)) {
case 0:
predicate = SpatialOperation.Contains;
break;
case 1:
predicate = SpatialOperation.IsWithin;
break;
default:
predicate = SpatialOperation.Intersects;
break;
}
final SpatialPrefixTree gridQuad = new QuadPrefixTree(ctx, 10);
final SpatialPrefixTree gridGeohash = new GeohashPrefixTree(ctx, 10);
Collection<SpatialStrategy> strategies = new ArrayList<>();
RecursivePrefixTreeStrategy recursive_geohash = new RecursivePrefixTreeStrategy(gridGeohash, "recursive_geohash");
strategies.add(recursive_geohash);
strategies.add(new TermQueryPrefixTreeStrategy(gridQuad, "termquery_quad"));
strategies.add(PointVectorStrategy.newInstance(ctx, "pointvector"));
strategies.add(BBoxStrategy.newInstance(ctx, "bbox"));
final SerializedDVStrategy serialized = new SerializedDVStrategy(ctx, "serialized");
strategies.add(serialized);
strategies.add(new CompositeSpatialStrategy("composite", recursive_geohash, serialized));
for (SpatialStrategy strategy : strategies) {
testEqualsHashcode(strategy);
}
}
use of org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy in project lucene-solr by apache.
the class Geo3dRptTest method newRPT.
protected RecursivePrefixTreeStrategy newRPT() {
final RecursivePrefixTreeStrategy rpt = new RecursivePrefixTreeStrategy(this.grid, getClass().getSimpleName() + "_rpt");
//not too many cells
rpt.setDistErrPct(0.10);
return rpt;
}
use of org.apache.lucene.spatial.prefix.RecursivePrefixTreeStrategy in project lucene-solr by apache.
the class RptWithGeometrySpatialField method newSpatialStrategy.
@Override
protected CompositeSpatialStrategy newSpatialStrategy(String fieldName) {
// We use the same field name for both sub-strategies knowing there will be no conflict for these two
RecursivePrefixTreeStrategy rptStrategy = rptFieldType.newSpatialStrategy(fieldName);
SerializedDVStrategy geomStrategy = new CachingSerializedDVStrategy(ctx, fieldName);
return new CompositeSpatialStrategy(fieldName, rptStrategy, geomStrategy);
}
Aggregations