public DistanceCollector(Coordinates centerCoordinates, int hitsCount, String fieldname) { this.center = Point.fromCoordinates( centerCoordinates ); this.distances = new SpatialResultsCollector( hitsCount ); this.latitudeField = SpatialHelper.formatLatitude( fieldname ); this.longitudeField = SpatialHelper.formatLongitude( fieldname ); }
public Double getDistance(final int index) { return distances.get( index, center ); }
@Override public void collect(int doc) throws IOException { final int absolute = docBase + doc; if ( docsWithLatitude.get( doc ) && docsWithLongitude.get( doc ) ) { double lat = coordinate( latitudeValues, doc ); double lon = coordinate( longitudeValues, doc ); distances.put( absolute, lat, lon ); } else { distances.putIncomplete( absolute ); } } }
public Double getDistance(final int index) { return distances.get( index, center ); }
@Override public void collect(int doc) throws IOException { final int absolute = docBase + doc; if ( docsWithLatitude.get( doc ) && docsWithLongitude.get( doc ) ) { double lat = coordinate( latitudeValues, doc ); double lon = coordinate( longitudeValues, doc ); distances.put( absolute, lat, lon ); } else { distances.putIncomplete( absolute ); } } }
public DistanceCollector(Coordinates centerCoordinates, int hitsCount, String fieldname) { this.center = Point.fromCoordinates( centerCoordinates ); this.distances = new SpatialResultsCollector( hitsCount ); this.latitudeField = SpatialHelper.formatLatitude( fieldname ); this.longitudeField = SpatialHelper.formatLongitude( fieldname ); }