Package org.apache.lucene.spatial.prefix.tree

Examples of org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree


  @ParametersFactory
  public static Iterable<Object[]> parameters() {
    List<Object[]> ctorArgs = new ArrayList<Object[]>();

    SpatialContext ctx = SpatialContext.GEO;
    SpatialPrefixTree grid;
    SpatialStrategy strategy;

    grid = new GeohashPrefixTree(ctx,12);
    strategy = new RecursivePrefixTreeStrategy(grid, "recursive_geohash");
    ctorArgs.add(new Object[]{new Param(strategy)});
View Full Code Here


  }

  protected SpatialStrategy makeSpatialStrategy(final Config config, Map<String, String> configMap,
                                                SpatialContext ctx) {
    //A factory for the prefix tree grid
    SpatialPrefixTree grid = SpatialPrefixTreeFactory.makeSPT(configMap, null, ctx);

    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, SPATIAL_FIELD) {
      {
        //protected field
        this.pointsOnly = config.get("spatial.docPointsOnly", false);
      }
    };

    int prefixGridScanLevel = config.get("query.spatial.prefixGridScanLevel", -4);
    if (prefixGridScanLevel < 0)
      prefixGridScanLevel = grid.getMaxLevels() + prefixGridScanLevel;
    strategy.setPrefixGridScanLevel(prefixGridScanLevel);

    double distErrPct = config.get("spatial.distErrPct", .025);//doc & query; a default
    strategy.setDistErrPct(distErrPct);
    return strategy;
View Full Code Here

  }

  @Override
  public void configure(String fieldNameForThisInstance, Map<String, String> properties, Configuration configuration) {
    _ctx = SpatialContext.GEO;
    SpatialPrefixTree grid = getSpatialPrefixTree(properties);
    _strategy = new TermQueryPrefixTreeStrategy(grid, fieldNameForThisInstance);
    _shapeReadWriter = new ShapeReadWriter<SpatialContext>(_ctx);
    addSupportedIndexedShapes(Point.class);
    addSupportedOperations(SpatialOperation.Intersects);
  }
View Full Code Here

  }

  @Override
  public void configure(String fieldNameForThisInstance, Map<String, String> properties, Configuration configuration) {
    _ctx = SpatialContext.GEO;
    SpatialPrefixTree grid = getSpatialPrefixTree(properties);
    _strategy = new RecursivePrefixTreeStrategy(grid, fieldNameForThisInstance);
    _shapeReadWriter = new ShapeReadWriter<SpatialContext>(_ctx);
    addSupportedIndexedShapes(Shape.class);
    addSupportedOperations(SpatialOperation.IsDisjointTo);
    addSupportedOperations(SpatialOperation.Intersects);
View Full Code Here

  @Test
  public void test28() throws ParseException {
    SpatialContext ctx = SpatialContext.GEO;
    ShapeReadWriter<SpatialContext> shapeReadWriter = new ShapeReadWriter<SpatialContext>(ctx);
    int maxLevels = 11;
    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis");
    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_KM));
    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);

    String writeSpatialArgs = SpatialArgsParser.writeSpatialArgs(args, shapeReadWriter);
View Full Code Here

 
  @Test
  public void test29() throws ParseException {
    SpatialContext ctx = SpatialContext.GEO;
    int maxLevels = 11;
    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis");
    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_KM));
    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);
   
    Query q1 = sq(strategy.makeQuery(args));
View Full Code Here

 
  @Test
  public void test30() throws ParseException {
    SpatialContext ctx = SpatialContext.GEO;
    int maxLevels = 11;
    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis");
    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_MI));
    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);
   
    Query q1 = sq(strategy.makeQuery(args));
View Full Code Here

  @Test
  public void test28() throws ParseException {
    SpatialContext ctx = SpatialContext.GEO;
    ShapeReadWriter<SpatialContext> shapeReadWriter = new ShapeReadWriter<SpatialContext>(ctx);
    int maxLevels = 11;
    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis");
    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_KM));
    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);

    String writeSpatialArgs = SpatialArgsParser.writeSpatialArgs(args, shapeReadWriter);
View Full Code Here

  @Test
  public void test29() throws ParseException {
    SpatialContext ctx = SpatialContext.GEO;
    int maxLevels = 11;
    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis");
    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_KM));
    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);

    Query q1 = sq(strategy.makeQuery(args));
View Full Code Here

  @Test
  public void test30() throws ParseException {
    SpatialContext ctx = SpatialContext.GEO;
    int maxLevels = 11;
    SpatialPrefixTree grid = new GeohashPrefixTree(ctx, maxLevels);
    RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(grid, "a.id_gis");
    Circle circle = ctx.makeCircle(-80.0, 33.0, DistanceUtils.dist2Degrees(10, DistanceUtils.EARTH_MEAN_RADIUS_MI));
    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, circle);

    Query q1 = sq(strategy.makeQuery(args));
View Full Code Here

TOP

Related Classes of org.apache.lucene.spatial.prefix.tree.SpatialPrefixTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.