@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; } } };
@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; } } };
@Override public void setDocument(int doc) { geoPointValues.setDocument(doc); resize(geoPointValues.count() * fromPoints.length); int v = 0; for (GeoPoint from : fromPoints) { for (int i = 0; i < geoPointValues.count(); ++i) { final GeoPoint point = geoPointValues.valueAt(i); values[v] = distance.calculate(from.lat(), from.lon(), point.lat(), point.lon(), unit); v++; } } sort(); } };
@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; } } };