本文整理汇总了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;
}
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:GeoFilterIT.java
示例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);
}
开发者ID:europeana,项目名称:search,代码行数:23,代码来源:RecursivePrefixTreeStrategy.java
示例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);
}
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:TermQueryPrefixTreeStrategy.java
示例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;
}
开发者ID:europeana,项目名称:search,代码行数:24,代码来源:BBoxStrategy.java
示例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);
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:19,代码来源:TermQueryPrefixTreeStrategy.java
示例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);
}
开发者ID:apache,项目名称:incubator-blur,代码行数:18,代码来源:TermQueryPrefixTreeStrategy.java
示例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);
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:23,代码来源:RecursivePrefixTreeStrategy.java
示例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);
}
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:TermQueryPrefixTreeStrategy.java
示例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
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:15,代码来源:RecursivePrefixTreeStrategy.java
示例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);
}
开发者ID:apache,项目名称:incubator-blur,代码行数:28,代码来源:RecursivePrefixTreeStrategy.java
注:本文中的org.apache.lucene.spatial.query.UnsupportedSpatialOperation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论