summaryrefslogtreecommitdiff
path: root/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java
diff options
context:
space:
mode:
authorAdrien Grand <jpountz@gmail.com>2017-04-18 15:17:21 +0200
committerGitHub <noreply@github.com>2017-04-18 15:17:21 +0200
commit4632661bc71bb22fc577df476e70e9dfabaaae66 (patch)
tree6e10e1ffaa792c5fa46251d861736e59c9ed3404 /core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java
parentf217eb8ad8d3ecc82e2f926222b1f036b0d555b7 (diff)
Upgrade to a Lucene 7 snapshot (#24089)
We want to upgrade to Lucene 7 ahead of time in order to be able to check whether it causes any trouble to Elasticsearch before Lucene 7.0 gets released. From a user perspective, the main benefit of this upgrade is the enhanced support for sparse fields, whose resource consumption is now function of the number of docs that have a value rather than the total number of docs in the index. Some notes about the change: - it includes the deprecation of the `disable_coord` parameter of the `bool` and `common_terms` queries: Lucene has removed support for coord factors - it includes the deprecation of the `index.similarity.base` expert setting, since it was only useful to configure coords and query norms, which have both been removed - two tests have been marked with `@AwaitsFix` because of #23966, which we intend to address after the merge
Diffstat (limited to 'core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java')
-rw-r--r--core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java23
1 files changed, 14 insertions, 9 deletions
diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java
index 602c3a81c6..1c60247446 100644
--- a/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java
+++ b/core/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregationBuilder.java
@@ -28,10 +28,10 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ObjectParser;
import org.elasticsearch.common.xcontent.XContentBuilder;
+import org.elasticsearch.index.fielddata.AbstractSortingNumericDocValues;
import org.elasticsearch.index.fielddata.MultiGeoPointValues;
import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
import org.elasticsearch.index.fielddata.SortedNumericDoubleValues;
-import org.elasticsearch.index.fielddata.SortingNumericDocValues;
import org.elasticsearch.index.query.QueryParseContext;
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
import org.elasticsearch.search.aggregations.AggregatorFactory;
@@ -187,7 +187,7 @@ public class GeoGridAggregationBuilder extends ValuesSourceAggregationBuilder<Va
return NAME;
}
- private static class CellValues extends SortingNumericDocValues {
+ private static class CellValues extends AbstractSortingNumericDocValues {
private MultiGeoPointValues geoValues;
private int precision;
@@ -197,14 +197,19 @@ public class GeoGridAggregationBuilder extends ValuesSourceAggregationBuilder<Va
}
@Override
- public void setDocument(int docId) {
- geoValues.setDocument(docId);
- resize(geoValues.count());
- for (int i = 0; i < count(); ++i) {
- GeoPoint target = geoValues.valueAt(i);
- values[i] = GeoHashUtils.longEncode(target.getLon(), target.getLat(), precision);
+ public boolean advanceExact(int docId) throws IOException {
+ if (geoValues.advanceExact(docId)) {
+ resize(geoValues.docValueCount());
+ for (int i = 0; i < docValueCount(); ++i) {
+ GeoPoint target = geoValues.nextValue();
+ values[i] = GeoHashUtils.longEncode(target.getLon(), target.getLat(),
+ precision);
+ }
+ sort();
+ return true;
+ } else {
+ return false;
}
- sort();
}
}