本文整理汇总了Java中org.apache.lucene.spatial.query.UnsupportedSpatialOperation类的典型用法代码示例。如果您正苦于以下问题:Java UnsupportedSpatialOperation类的具体用法?Java UnsupportedSpatialOperation怎么用?Java UnsupportedSpatialOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnsupportedSpatialOperation类属于org.apache.lucene.spatial.query包,在下文中一共展示了UnsupportedSpatialOperation类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRelationSupport
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
protected static boolean testRelationSupport(SpatialOperation relation) {
if (relation == SpatialOperation.IsDisjointTo) {
// disjoint works in terms of intersection
relation = SpatialOperation.Intersects;
}
try {
GeohashPrefixTree tree = new GeohashPrefixTree(SpatialContext.GEO, 3);
RecursivePrefixTreeStrategy strategy = new RecursivePrefixTreeStrategy(tree, "area");
Shape shape = SpatialContext.GEO.makePoint(0, 0);
SpatialArgs args = new SpatialArgs(relation, shape);
strategy.makeQuery(args);
return true;
} catch (UnsupportedSpatialOperation e) {
final SpatialOperation finalRelation = relation;
ESLoggerFactory
.getLogger(GeoFilterIT.class.getName())
.info((Supplier<?>) () -> new ParameterizedMessage("Unsupported spatial operation {}", finalRelation), e);
return false;
}
}
示例2: makeFilter
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
@Override
public Filter makeFilter(SpatialArgs args) {
final SpatialOperation op = args.getOperation();
if (op == SpatialOperation.IsDisjointTo) //Note: in 5x support has been removed
return new DisjointSpatialFilter(this, args, getFieldName());
Shape shape = args.getShape();
int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct));
if (pointsOnly || op == SpatialOperation.Intersects) {
return new IntersectsPrefixTreeFilter(
shape, getFieldName(), grid, detailLevel, prefixGridScanLevel, !pointsOnly);
} else if (op == SpatialOperation.IsWithin) {
return new WithinPrefixTreeFilter(
shape, getFieldName(), grid, detailLevel, prefixGridScanLevel,
-1);//-1 flag is slower but ensures correct results
} else if (op == SpatialOperation.Contains) {
return new ContainsPrefixTreeFilter(shape, getFieldName(), grid, detailLevel,
multiOverlappingIndexedShapes);
}
throw new UnsupportedSpatialOperation(op);
}
示例3: makeFilter
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
@Override
public Filter makeFilter(SpatialArgs args) {
final SpatialOperation op = args.getOperation();
if (op != SpatialOperation.Intersects)
throw new UnsupportedSpatialOperation(op);
Shape shape = args.getShape();
int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct));
List<Cell> cells = grid.getCells(shape, detailLevel,
false,//no parents
true);//simplify
BytesRef[] terms = new BytesRef[cells.size()];
int i = 0;
for (Cell cell : cells) {
terms[i++] = new BytesRef(cell.getTokenString());//TODO use cell.getTokenBytes()
}
return new TermsFilter(getFieldName(), terms);
}
示例4: makeSpatialQuery
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
private Query makeSpatialQuery(SpatialArgs args) {
Shape shape = args.getShape();
if (!(shape instanceof Rectangle))
throw new UnsupportedOperationException("Can only query by Rectangle, not " + shape);
Rectangle bbox = (Rectangle) shape;
Query spatial;
// Useful for understanding Relations:
// http://edndoc.esri.com/arcsde/9.1/general_topics/understand_spatial_relations.htm
SpatialOperation op = args.getOperation();
if( op == SpatialOperation.BBoxIntersects ) spatial = makeIntersects(bbox);
else if( op == SpatialOperation.BBoxWithin ) spatial = makeWithin(bbox);
else if( op == SpatialOperation.Contains ) spatial = makeContains(bbox);
else if( op == SpatialOperation.Intersects ) spatial = makeIntersects(bbox);
else if( op == SpatialOperation.IsEqualTo ) spatial = makeEquals(bbox);
else if( op == SpatialOperation.IsDisjointTo ) spatial = makeDisjoint(bbox);
else if( op == SpatialOperation.IsWithin ) spatial = makeWithin(bbox);
else { //no Overlaps support yet
throw new UnsupportedSpatialOperation(op);
}
return spatial;
}
示例5: makeFilter
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
@Override
public Filter makeFilter(SpatialArgs args) {
final SpatialOperation op = args.getOperation();
if (op != SpatialOperation.Intersects)
throw new UnsupportedSpatialOperation(op);
Shape shape = args.getShape();
int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct));
List<Node> cells = grid.getNodes(shape, detailLevel,
false,//no parents
true);//simplify
BytesRef[] terms = new BytesRef[cells.size()];
int i = 0;
for (Node cell : cells) {
terms[i++] = new BytesRef(cell.getTokenString());
}
return new TermsFilter(getFieldName(), terms);
}
示例6: makeFilter
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
@Override
public Filter makeFilter(SpatialArgs args) {
final SpatialOperation op = args.getOperation();
if (op != SpatialOperation.Intersects)
throw new UnsupportedSpatialOperation(op);
Shape shape = args.getShape();
int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct));
List<Cell> cells = grid.getCells(shape, detailLevel, false,// no parents
true);// simplify
BytesRef[] terms = new BytesRef[cells.size()];
int i = 0;
for (Cell cell : cells) {
terms[i++] = new BytesRef(cell.getTokenString());
}
return new TermsFilter(getFieldName(), terms);
}
示例7: makeFilter
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
@Override
public Filter makeFilter(SpatialArgs args) {
final SpatialOperation op = args.getOperation();
if (op == SpatialOperation.IsDisjointTo)
return new DisjointSpatialFilter(this, args, getFieldName());
Shape shape = args.getShape();
int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct));
if (pointsOnly || op == SpatialOperation.Intersects) {
return new IntersectsPrefixTreeFilter(
shape, getFieldName(), grid, detailLevel, prefixGridScanLevel, !pointsOnly);
} else if (op == SpatialOperation.IsWithin) {
return new WithinPrefixTreeFilter(
shape, getFieldName(), grid, detailLevel, prefixGridScanLevel,
-1);//-1 flag is slower but ensures correct results
} else if (op == SpatialOperation.Contains) {
return new ContainsPrefixTreeFilter(shape, getFieldName(), grid, detailLevel,
multiOverlappingIndexedShapes);
}
throw new UnsupportedSpatialOperation(op);
}
示例8: makeFilter
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
@Override
public Filter makeFilter(SpatialArgs args) {
final SpatialOperation op = args.getOperation();
if (op != SpatialOperation.Intersects)
throw new UnsupportedSpatialOperation(op);
Shape shape = args.getShape();
int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct));
List<Cell> cells = grid.getCells(shape, detailLevel,
false,//no parents
true);//simplify
BytesRef[] terms = new BytesRef[cells.size()];
int i = 0;
for (Cell cell : cells) {
terms[i++] = new BytesRef(cell.getTokenString());
}
return new TermsFilter(getFieldName(), terms);
}
示例9: makeFilter
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
@Override
public Filter makeFilter(SpatialArgs args) {
final SpatialOperation op = args.getOperation();
if (op != SpatialOperation.Intersects)
throw new UnsupportedSpatialOperation(op);
Shape shape = args.getShape();
int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct));
return new IntersectsPrefixTreeFilter(
shape, getFieldName(), grid, detailLevel, prefixGridScanLevel,
true);//hasIndexedLeaves
}
示例10: makeFilter
import org.apache.lucene.spatial.query.UnsupportedSpatialOperation; //导入依赖的package包/类
@Override
public Filter makeFilter(SpatialArgs args) {
final SpatialOperation op = args.getOperation();
if (op == SpatialOperation.IsDisjointTo)
return new DisjointSpatialFilter(this, args, getFieldName());
Shape shape = args.getShape();
int detailLevel = grid.getLevelForDistance(args.resolveDistErr(ctx, distErrPct));
final boolean hasIndexedLeaves = true;
if (op == SpatialOperation.Intersects) {
return new IntersectsPrefixTreeFilter(shape, getFieldName(), grid, detailLevel, prefixGridScanLevel,
hasIndexedLeaves);
} else if (op == SpatialOperation.IsWithin) {
return new WithinPrefixTreeFilter(shape, getFieldName(), grid, detailLevel, prefixGridScanLevel, -1);// -1
// flag
// is
// slower
// but
// ensures
// correct
// results
} else if (op == SpatialOperation.Contains) {
return new ContainsPrefixTreeFilter(shape, getFieldName(), grid, detailLevel);
}
throw new UnsupportedSpatialOperation(op);
}