org.apache.lucene.spatial.vector.PointVectorStrategy Java Examples

The following examples show how to use org.apache.lucene.spatial.vector.PointVectorStrategy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QueryEqualsHashCodeTest.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Test
public void testEqualsHashCode() {

  switch (random().nextInt(4)) {//0-3
    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);
  }
}
 
Example #2
Source File: SpatialPointVectorStrategyFieldTypeDefinition.java    From incubator-retired-blur with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(String fieldNameForThisInstance, Map<String, String> properties, Configuration configuration) {
  _ctx = SpatialContext.GEO;
  _strategy = new PointVectorStrategy(_ctx, fieldNameForThisInstance);
  _shapeReadWriter = new ShapeReadWriter<SpatialContext>(_ctx);
  _alternateFieldNames = Arrays.asList(fieldNameForThisInstance + PointVectorStrategy.SUFFIX_X,
      fieldNameForThisInstance + PointVectorStrategy.SUFFIX_Y);
  addSupportedIndexedShapes(Point.class);
  addSupportedOperations(SpatialOperation.Intersects);
}