當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。