当前位置: 首页>>代码示例>>Java>>正文


Java GeoPoint类代码示例

本文整理汇总了Java中org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint的典型用法代码示例。如果您正苦于以下问题:Java GeoPoint类的具体用法?Java GeoPoint怎么用?Java GeoPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


GeoPoint类属于org.elasticsearch.search.aggregations.support.ValuesSource包,在下文中一共展示了GeoPoint类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint; //导入依赖的package包/类
@Override
public AggregatorFactory parse(String aggregationName, XContentParser parser, SearchContext context) throws IOException {
    ValuesSourceParser<GeoPoint> vsParser = ValuesSourceParser.geoPoint(aggregationName, InternalConvexHull.TYPE, context)
            .targetValueType(ValueType.GEOPOINT)
            .formattable(true)
            .build();

    XContentParser.Token token;

    String currentFieldName = null;

    while((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (vsParser.token(currentFieldName, token, parser)) {
            continue;
        }
    }
    return new ConvexHullAggregator.Factory(aggregationName, vsParser.config());
}
 
开发者ID:opendatasoft,项目名称:elasticsearch-aggregation-envelope,代码行数:21,代码来源:ConvexHullParser.java

示例2: GeoHashGridAggregatorFactory

import org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint; //导入依赖的package包/类
GeoHashGridAggregatorFactory(String name, ValuesSourceConfig<GeoPoint> config, int precision, int requiredSize,
        int shardSize, SearchContext context, AggregatorFactory<?> parent, AggregatorFactories.Builder subFactoriesBuilder,
        Map<String, Object> metaData) throws IOException {
    super(name, config, context, parent, subFactoriesBuilder, metaData);
    this.precision = precision;
    this.requiredSize = requiredSize;
    this.shardSize = shardSize;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:GeoHashGridAggregatorFactory.java

示例3: doCreateInternal

import org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint; //导入依赖的package包/类
@Override
protected Aggregator doCreateInternal(final ValuesSource.GeoPoint valuesSource, Aggregator parent, boolean collectsFromSingleBucket,
        List<PipelineAggregator> pipelineAggregators, Map<String, Object> metaData) throws IOException {
    if (collectsFromSingleBucket == false) {
        return asMultiBucketAggregator(this, context, parent);
    }
    CellIdSource cellIdSource = new CellIdSource(valuesSource, precision);
    return new GeoHashGridAggregator(name, factories, cellIdSource, requiredSize, shardSize, context, parent,
            pipelineAggregators, metaData);

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:GeoHashGridAggregatorFactory.java

示例4: parse

import org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint; //导入依赖的package包/类
@Override
public AggregatorFactory parse(String aggregationName, XContentParser parser, SearchContext context) throws IOException {
    ValuesSourceParser<GeoPoint> vsParser = ValuesSourceParser.geoPoint(aggregationName, InternalGeoBounds.TYPE, context)
            .targetValueType(ValueType.GEOPOINT)
            .formattable(true)
            .build();
    boolean wrapLongitude = true;
    XContentParser.Token token;
    String currentFieldName = null;
    while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
        if (token == XContentParser.Token.FIELD_NAME) {
            currentFieldName = parser.currentName();
        } else if (vsParser.token(currentFieldName, token, parser)) {
            continue;
            
        } else if (token == XContentParser.Token.VALUE_BOOLEAN) {
            if ("wrap_longitude".equals(currentFieldName) || "wrapLongitude".equals(currentFieldName)) {
                wrapLongitude = parser.booleanValue();
            } else {
                throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: ["
                        + currentFieldName + "].", parser.getTokenLocation());
            }
        } else {
            throw new SearchParseException(context, "Unknown key for a " + token + " in aggregation [" + aggregationName + "]: ["
                    + currentFieldName + "].", parser.getTokenLocation());
        }
    }
    return new GeoBoundsAggregator.Factory(aggregationName, vsParser.config(), wrapLongitude);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:30,代码来源:GeoBoundsParser.java


注:本文中的org.elasticsearch.search.aggregations.support.ValuesSource.GeoPoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。