本文整理汇总了Java中org.apache.lucene.spatial.prefix.PrefixTreeStrategy类的典型用法代码示例。如果您正苦于以下问题:Java PrefixTreeStrategy类的具体用法?Java PrefixTreeStrategy怎么用?Java PrefixTreeStrategy使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PrefixTreeStrategy类属于org.apache.lucene.spatial.prefix包,在下文中一共展示了PrefixTreeStrategy类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testDefaultConfiguration
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy; //导入依赖的package包/类
public void testDefaultConfiguration() throws IOException {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("properties").startObject("location")
.field("type", "geo_shape")
.endObject().endObject()
.endObject().endObject().string();
DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping));
FieldMapper fieldMapper = defaultMapper.mappers().getMapper("location");
assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class));
GeoShapeFieldMapper geoShapeFieldMapper = (GeoShapeFieldMapper) fieldMapper;
PrefixTreeStrategy strategy = geoShapeFieldMapper.fieldType().defaultStrategy();
assertThat(strategy.getDistErrPct(), equalTo(0.025d));
assertThat(strategy.getGrid(), instanceOf(GeohashPrefixTree.class));
assertThat(strategy.getGrid().getMaxLevels(), equalTo(GeoShapeFieldMapper.Defaults.GEOHASH_LEVELS));
assertThat(geoShapeFieldMapper.fieldType().orientation(), equalTo(GeoShapeFieldMapper.Defaults.ORIENTATION));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:GeoShapeFieldMapperTests.java
示例2: testGeohashConfiguration
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy; //导入依赖的package包/类
public void testGeohashConfiguration() throws IOException {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("properties").startObject("location")
.field("type", "geo_shape")
.field("tree", "geohash")
.field("tree_levels", "4")
.field("distance_error_pct", "0.1")
.endObject().endObject()
.endObject().endObject().string();
DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping));
FieldMapper fieldMapper = defaultMapper.mappers().getMapper("location");
assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class));
GeoShapeFieldMapper geoShapeFieldMapper = (GeoShapeFieldMapper) fieldMapper;
PrefixTreeStrategy strategy = geoShapeFieldMapper.fieldType().defaultStrategy();
assertThat(strategy.getDistErrPct(), equalTo(0.1));
assertThat(strategy.getGrid(), instanceOf(GeohashPrefixTree.class));
assertThat(strategy.getGrid().getMaxLevels(), equalTo(4));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:22,代码来源:GeoShapeFieldMapperTests.java
示例3: testQuadtreeConfiguration
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy; //导入依赖的package包/类
public void testQuadtreeConfiguration() throws IOException {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("properties").startObject("location")
.field("type", "geo_shape")
.field("tree", "quadtree")
.field("tree_levels", "6")
.field("distance_error_pct", "0.5")
.field("points_only", true)
.endObject().endObject()
.endObject().endObject().string();
DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping));
FieldMapper fieldMapper = defaultMapper.mappers().getMapper("location");
assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class));
GeoShapeFieldMapper geoShapeFieldMapper = (GeoShapeFieldMapper) fieldMapper;
PrefixTreeStrategy strategy = geoShapeFieldMapper.fieldType().defaultStrategy();
assertThat(strategy.getDistErrPct(), equalTo(0.5));
assertThat(strategy.getGrid(), instanceOf(QuadPrefixTree.class));
assertThat(strategy.getGrid().getMaxLevels(), equalTo(6));
assertThat(strategy.isPointsOnly(), equalTo(true));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:24,代码来源:GeoShapeFieldMapperTests.java
示例4: testPointsOnlyOption
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy; //导入依赖的package包/类
public void testPointsOnlyOption() throws IOException {
String mapping = XContentFactory.jsonBuilder().startObject().startObject("type1")
.startObject("properties").startObject("location")
.field("type", "geo_shape")
.field("tree", "geohash")
.field("points_only", true)
.endObject().endObject()
.endObject().endObject().string();
DocumentMapper defaultMapper = createIndex("test").mapperService().documentMapperParser().parse("type1", new CompressedXContent(mapping));
FieldMapper fieldMapper = defaultMapper.mappers().getMapper("location");
assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class));
GeoShapeFieldMapper geoShapeFieldMapper = (GeoShapeFieldMapper) fieldMapper;
PrefixTreeStrategy strategy = geoShapeFieldMapper.fieldType().defaultStrategy();
assertThat(strategy.getGrid(), instanceOf(GeohashPrefixTree.class));
assertThat(strategy.isPointsOnly(), equalTo(true));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:20,代码来源:GeoShapeFieldMapperTests.java
示例5: resolveStrategy
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy; //导入依赖的package包/类
public PrefixTreeStrategy resolveStrategy(String strategyName) {
if (SpatialStrategy.RECURSIVE.getStrategyName().equals(strategyName)) {
return recursiveStrategy;
}
if (SpatialStrategy.TERM.getStrategyName().equals(strategyName)) {
return termStrategy;
}
throw new IllegalArgumentException("Unknown prefix tree strategy [" + strategyName + "]");
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:GeoShapeFieldMapper.java
示例6: defaultStrategy
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy; //导入依赖的package包/类
public PrefixTreeStrategy defaultStrategy() {
return this.defaultStrategy;
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:GeoShapeFieldMapper.java
示例7: testGeoShapeMapperMerge
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy; //导入依赖的package包/类
public void testGeoShapeMapperMerge() throws Exception {
String stage1Mapping = XContentFactory.jsonBuilder().startObject().startObject("type").startObject("properties")
.startObject("shape").field("type", "geo_shape").field("tree", "geohash").field("strategy", "recursive")
.field("precision", "1m").field("tree_levels", 8).field("distance_error_pct", 0.01).field("orientation", "ccw")
.endObject().endObject().endObject().endObject().string();
MapperService mapperService = createIndex("test").mapperService();
DocumentMapper docMapper = mapperService.merge("type", new CompressedXContent(stage1Mapping), MapperService.MergeReason.MAPPING_UPDATE, false);
String stage2Mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("shape").field("type", "geo_shape").field("tree", "quadtree")
.field("strategy", "term").field("precision", "1km").field("tree_levels", 26).field("distance_error_pct", 26)
.field("orientation", "cw").endObject().endObject().endObject().endObject().string();
try {
mapperService.merge("type", new CompressedXContent(stage2Mapping), MapperService.MergeReason.MAPPING_UPDATE, false);
fail();
} catch (IllegalArgumentException e) {
assertThat(e.getMessage(), containsString("mapper [shape] has different [strategy]"));
assertThat(e.getMessage(), containsString("mapper [shape] has different [tree]"));
assertThat(e.getMessage(), containsString("mapper [shape] has different [tree_levels]"));
assertThat(e.getMessage(), containsString("mapper [shape] has different [precision]"));
}
// verify nothing changed
FieldMapper fieldMapper = docMapper.mappers().getMapper("shape");
assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class));
GeoShapeFieldMapper geoShapeFieldMapper = (GeoShapeFieldMapper) fieldMapper;
PrefixTreeStrategy strategy = geoShapeFieldMapper.fieldType().defaultStrategy();
assertThat(strategy, instanceOf(RecursivePrefixTreeStrategy.class));
assertThat(strategy.getGrid(), instanceOf(GeohashPrefixTree.class));
assertThat(strategy.getDistErrPct(), equalTo(0.01));
assertThat(strategy.getGrid().getMaxLevels(), equalTo(GeoUtils.geoHashLevelsForPrecision(1d)));
assertThat(geoShapeFieldMapper.fieldType().orientation(), equalTo(ShapeBuilder.Orientation.CCW));
// correct mapping
stage2Mapping = XContentFactory.jsonBuilder().startObject().startObject("type")
.startObject("properties").startObject("shape").field("type", "geo_shape").field("precision", "1m")
.field("tree_levels", 8).field("distance_error_pct", 0.001).field("orientation", "cw").endObject().endObject().endObject().endObject().string();
docMapper = mapperService.merge("type", new CompressedXContent(stage2Mapping), MapperService.MergeReason.MAPPING_UPDATE, false);
fieldMapper = docMapper.mappers().getMapper("shape");
assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class));
geoShapeFieldMapper = (GeoShapeFieldMapper) fieldMapper;
strategy = geoShapeFieldMapper.fieldType().defaultStrategy();
assertThat(strategy, instanceOf(RecursivePrefixTreeStrategy.class));
assertThat(strategy.getGrid(), instanceOf(GeohashPrefixTree.class));
assertThat(strategy.getDistErrPct(), equalTo(0.001));
assertThat(strategy.getGrid().getMaxLevels(), equalTo(GeoUtils.geoHashLevelsForPrecision(1d)));
assertThat(geoShapeFieldMapper.fieldType().orientation(), equalTo(ShapeBuilder.Orientation.CW));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:53,代码来源:GeoShapeFieldMapperTests.java
示例8: GeoHeatmapAggregator
import org.apache.lucene.spatial.prefix.PrefixTreeStrategy; //导入依赖的package包/类
/**
* Used by the {@link GeoHeatmapAggregatorFactory} to create a new instance
*
* @param name
* the name of this heatmap aggregator
* @param inputShape
* indexed shapes must intersect inputShape to be counted; if
* null the world rectangle is used
* @param strategy
* a geo strategy for searching the field
* @param maxCells
* the maximum number of cells (grid squares) that could possibly
* be returned from the heatmap
* @param gridLevel
* manually set the granularity of the grid
* @param context
* the search context of this aggregation
* @param parent
* the parent aggregation
* @param pipelineAggregators
* any pipeline aggregations attached
* @param metaData
* aggregation metadata
* @throws IOException
* when parsing fails
*/
GeoHeatmapAggregator(String name, Shape inputShape, PrefixTreeStrategy strategy, int maxCells, int gridLevel,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metaData) throws IOException {
super(name, context, parent, pipelineAggregators, metaData);
this.inputShape = inputShape;
this.strategy = strategy;
this.maxCells = maxCells;
this.gridLevel = gridLevel;
}
开发者ID:boundlessgeo,项目名称:elasticsearch-heatmap,代码行数:36,代码来源:GeoHeatmapAggregator.java
注:本文中的org.apache.lucene.spatial.prefix.PrefixTreeStrategy类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论