@Override public GeoPoint nextValue() throws IOException { if (count > 0) { return values.nextValue(); } else { return missing; } } };
@Override public void get(List<CharSequence> list) throws IOException { for (int i = 0, count = values.docValueCount(); i < count; ++i) { list.add(values.nextValue().toString()); } } });
@Override protected String getDistanceString(LeafReaderContext ctx, int docId) throws IOException { StringBuilder values = new StringBuilder(mode.name()); values.append(" of: ["); final MultiGeoPointValues geoPointValues = fieldData.load(ctx).getGeoPointValues(); if (geoPointValues.advanceExact(docId)) { final int num = geoPointValues.docValueCount(); for (int i = 0; i < num; i++) { GeoPoint value = geoPointValues.nextValue(); values.append("Math.max(arcDistance("); values.append(value).append("(=doc value),"); values.append(origin).append("(=origin)) - ").append(offset).append("(=offset), 0)"); if (i != num - 1) { values.append(", "); } } } else { values.append("0.0"); } values.append("]"); return values.toString(); }
@Override public void setNextDocId(int docId) throws IOException { if (in.advanceExact(docId)) { resize(in.docValueCount()); for (int i = 0; i < count; i++) { GeoPoint point = in.nextValue(); values[i] = new GeoPoint(point.lat(), point.lon()); } } else { resize(0); } }
@Override public boolean advanceExact(int docId) throws IOException { if (geoPointValues.advanceExact(docId)) { int n = geoPointValues.docValueCount(); resize(n); for (int i = 0; i < n; i++) { GeoPoint other = geoPointValues.nextValue(); double distance = distFunction.calculate( origin.lat(), origin.lon(), other.lat(), other.lon(), DistanceUnit.METERS); values[i] = Math.max(0.0d, distance - offset); } sort(); return true; } else { return false; } } }), 0);
@Override 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; } } }
@Override public GeoPoint nextValue() throws IOException { if (count > 0) { return values.nextValue(); } else { return missing; } } };
@Override public GeoPoint nextValue() throws IOException { if (count > 0) { return values.nextValue(); } else { return missing; } } };
@Override public boolean advanceExact(int target) throws IOException { if (geoPointValues.advanceExact(target)) { resize(geoPointValues.docValueCount() * fromPoints.length); int v = 0; for (int i = 0; i < geoPointValues.docValueCount(); ++i) { final GeoPoint point = geoPointValues.nextValue(); for (GeoPoint from : fromPoints) { values[v] = distance.calculate(from.lat(), from.lon(), point.lat(), point.lon(), unit); v++; } } sort(); return true; } else { return false; } } };
GeoPoint value = values.nextValue(); pt[0] = pt[0] + (value.getLon() - pt[0]) / ++prevCounts; pt[1] = pt[1] + (value.getLat() - pt[1]) / prevCounts;
@Override public void get(List<CharSequence> list) throws IOException { for (int i = 0, count = values.docValueCount(); i < count; ++i) { list.add(values.nextValue().toString()); } } });
@Override public void get(List<CharSequence> list) throws IOException { for (int i = 0, count = values.docValueCount(); i < count; ++i) { list.add(values.nextValue().toString()); } } });
@Override public double doubleVal(int doc) throws IOException { if (values.advanceExact(doc)) { return values.nextValue().getLat(); } else { return 0.0; } } };
@Override public double doubleVal(int doc) throws IOException { if (values.advanceExact(doc)) { return values.nextValue().getLon(); } else { return 0.0; } } };
@Override public void setNextDocId(int docId) throws IOException { if (in.advanceExact(docId)) { resize(in.docValueCount()); for (int i = 0; i < count; i++) { GeoPoint point = in.nextValue(); values[i] = new GeoPoint(point.lat(), point.lon()); } } else { resize(0); } }
@Override public void setNextDocId(int docId) throws IOException { if (in.advanceExact(docId)) { resize(in.docValueCount()); for (int i = 0; i < count; i++) { GeoPoint point = in.nextValue(); values[i] = new GeoPoint(point.lat(), point.lon()); } } else { resize(0); } }
@Override public boolean advanceExact(int docId) throws IOException { if (geoPointValues.advanceExact(docId)) { int n = geoPointValues.docValueCount(); resize(n); for (int i = 0; i < n; i++) { GeoPoint other = geoPointValues.nextValue(); double distance = distFunction.calculate( origin.lat(), origin.lon(), other.lat(), other.lon(), DistanceUnit.METERS); values[i] = Math.max(0.0d, distance - offset); } sort(); return true; } else { return false; } } }), 0);
@Override public boolean advanceExact(int docId) throws IOException { if (geoPointValues.advanceExact(docId)) { int n = geoPointValues.docValueCount(); resize(n); for (int i = 0; i < n; i++) { GeoPoint other = geoPointValues.nextValue(); double distance = distFunction.calculate( origin.lat(), origin.lon(), other.lat(), other.lon(), DistanceUnit.METERS); values[i] = Math.max(0.0d, distance - offset); } sort(); return true; } else { return false; } } }), 0);
GeoPoint value = values.nextValue(); double top = tops.get(bucket); if (value.lat() > top) {
@Override 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; } } }