Package org.apache.lucene.spatial.query

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


  }

  @Test(expected = UnsupportedOperationException.class)
  public void testInvalidQueryShape() {
    Point point = ctx.makePoint(0, 0);
    SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, point);
    this.strategy.makeQuery(args);
  }
View Full Code Here


    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

    addDocument(doc);

    Point upperleft = ctx.makePoint(-122.88, 48.54);
    Point lowerright = ctx.makePoint(-122.82, 48.62);

    Query query = strategy.makeQuery(new SpatialArgs(SpatialOperation.Intersects, ctx.makeRectangle(upperleft, lowerright)));

    commit();

    TopDocs search = indexSearcher.search(query, 10);
    ScoreDoc[] scoreDocs = search.scoreDocs;
View Full Code Here

                                    // distance
                                    // (in
                                    // degrees)
    Sort distSort = new Sort(valueSource.getSortField(false))
        .rewrite(indexSearcher);
    SpatialArgs args = new SpatialArgs(operation, shape);
    args.setDistErr(0.0);
    Filter filter = strategy.makeFilter(args);
    TopDocs docs = indexSearcher.search(new MatchAllDocsQuery(), filter,
        limit, distSort);

    List<Node> results = new ArrayList<Node>();
View Full Code Here

                } else
                    throw new IllegalArgumentException("Relation is not supported for string value: " + titanPredicate);
            } else if (value instanceof Geoshape) {
                Preconditions.checkArgument(titanPredicate == Geo.WITHIN, "Relation is not supported for geo value: " + titanPredicate);
                Shape shape = ((Geoshape) value).convert2Spatial4j();
                SpatialArgs args = new SpatialArgs(SpatialOperation.IsWithin, shape);
                return getSpatialStrategy(key).makeFilter(args);
            } else throw new IllegalArgumentException("Unsupported type: " + value);
        } else if (condition instanceof Not) {
            BooleanFilter q = new BooleanFilter();
            q.add(convertQuery(((Not) condition).getChild(),informations), BooleanClause.Occur.MUST_NOT);
View Full Code Here

        //Auesee
        BooleanFilter filter = new BooleanFilter();
        //filter.add(new TermsFilter(new Term("name_txt","know")), BooleanClause.Occur.MUST);

        SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects,Geoshape.circle(51.666167,6.58905,450).convert2Spatial4j());
        //filter.add(getSpatialStrategy("location").makeFilter(args), BooleanClause.Occur.MUST);

        filter.add(NumericRangeFilter.newLongRange("time",(long)1000342034,(long)1000342034,true,true), BooleanClause.Occur.MUST);
//        filter.add(NumericRangeFilter.newLongRange("time",(long)1000342034-100,Long.MAX_VALUE,true,true), BooleanClause.Occur.MUST);
//        filter.add(NumericRangeFilter.newLongRange("time",Long.MIN_VALUE,(long)1000342034+300,true,true), BooleanClause.Occur.MUST);
View Full Code Here

    }
   
    public static SpatialArgs getArgs(ShapeBuilder shape, ShapeRelation relation) {
        switch(relation) {
        case DISJOINT:
            return new SpatialArgs(SpatialOperation.IsDisjointTo, shape.build());
        case INTERSECTS:
            return new SpatialArgs(SpatialOperation.Intersects, shape.build());
        case WITHIN:
            return new SpatialArgs(SpatialOperation.IsWithin, shape.build());
        default:
            throw new ElasticsearchIllegalArgumentException("");
       
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.lucene.spatial.query.SpatialArgs

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.