Examples of SpatialArgs


Examples of org.apache.lucene.spatial.query.SpatialArgs

    return queries.toArray(new Query[queries.size()]);
  }


  protected Query makeQueryFromShape(Shape shape) {
    SpatialArgs args = new SpatialArgs(operation, shape);
    if (!Double.isNaN(distErrPct))
      args.setDistErrPct(distErrPct);

    if (score) {
      ValueSource valueSource = strategy.makeDistanceValueSource(shape.getCenter());
      return new CustomScoreQuery(strategy.makeQuery(args), new FunctionQuery(valueSource));
    } else {
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

   */
  @Override
  public RandomAccessFilter buildRandomAccessFilter(String value, Properties selectionProperty)
      throws IOException {
    GeoRange range = GeoFacetCountCollector.parse(value);
    SpatialArgs spatialArgs = new SpatialArgs(SpatialOperation.Intersects,
        SpatialContext.GEO.makeCircle(range.getLon(), range.getLat(),
          DistanceUtils.dist2Degrees(range.getRad(), DistanceUtils.EARTH_MEAN_RADIUS_KM)));
    Filter filter = spatialStrategy.makeFilter(spatialArgs);
    if (filter == null) {
      return null;
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

    return q(pt, distDEG, 0.0);
  }

  private SpatialArgs q(Point pt, double distDEG, double distErrPct) {
    Shape shape = ctx.makeCircle(pt, distDEG);
    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects,shape);
    args.setDistErrPct(distErrPct);
    return args;
  }
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

      if (operation.evaluate(stringShapeEntry.getValue(), queryShape))
        expectedIds.add(stringShapeEntry.getKey());
    }

    SpatialTestQuery testQuery = new SpatialTestQuery();
    testQuery.args = new SpatialArgs(operation, queryShape);
    testQuery.ids = new ArrayList<String>(expectedIds);
    runTestQuery(SpatialMatchConcern.FILTER, testQuery);
  }
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

  @Test
  public void testEqualsHashCode() {

    final SpatialPrefixTree grid = new QuadPrefixTree(ctx,10);
    final SpatialArgs args1 = makeArgs1();
    final SpatialArgs args2 = makeArgs2();

    Collection<ObjGenerator> generators = new ArrayList<ObjGenerator>();
    generators.add(new ObjGenerator() {
      @Override
      public Object gen(SpatialArgs args) {
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

    assertNotSame(args1, args2);
  }

  private SpatialArgs makeArgs1() {
    final Shape shape1 = ctx.makeRectangle(0, 0, 10, 10);
    return new SpatialArgs(SpatialOperation.Intersects, shape1);
  }
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

    return new SpatialArgs(SpatialOperation.Intersects, shape1);
  }

  private SpatialArgs makeArgs2() {
    final Shape shape2 = ctx.makeRectangle(0, 0, 20, 20);
    return new SpatialArgs(SpatialOperation.Intersects, shape2);
  }
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

  @Test
  public void testContainsPairOverlap() throws IOException {
    mySetup(3);
    adoc("0", new ShapePair(ctx.makeRectangle(0, 33, -128, 128), ctx.makeRectangle(33, 128, -128, 128), true));
    commit();
    Query query = strategy.makeQuery(new SpatialArgs(SpatialOperation.Contains,
        ctx.makeRectangle(0, 128, -16, 128)));
    SearchResults searchResults = executeQuery(query, 1);
    assertEquals(1, searchResults.numFound);
  }
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

    mySetup(7);
    //one shape comprised of two parts, quite separated apart
    adoc("0", new ShapePair(ctx.makeRectangle(0, 10, -120, -100), ctx.makeRectangle(220, 240, 110, 125), false));
    commit();
    //query surrounds only the second part of the indexed shape
    Query query = strategy.makeQuery(new SpatialArgs(SpatialOperation.IsWithin,
        ctx.makeRectangle(210, 245, 105, 128)));
    SearchResults searchResults = executeQuery(query, 1);
    //we shouldn't find it because it's not completely within
    assertTrue(searchResults.numFound == 0);
  }
View Full Code Here

Examples of org.apache.lucene.spatial.query.SpatialArgs

    //query does NOT contain it; both indexed cells are leaves to the query, and
    // when expanded to the full grid cells, the top one's top row is disjoint
    // from the query and thus not a match.
    assertTrue(executeQuery(strategy.makeQuery(
        new SpatialArgs(SpatialOperation.IsWithin, ctx.makeRectangle(38, 192, -72, 56))
    ), 1).numFound==0);//no-match

    //this time the rect is a little bigger and is considered a match. It's a
    // an acceptable false-positive because of the grid approximation.
    assertTrue(executeQuery(strategy.makeQuery(
        new SpatialArgs(SpatialOperation.IsWithin, ctx.makeRectangle(38, 192, -72, 80))
    ), 1).numFound==1);//match
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.