public GeoIndexer(GeoSearchConfig config) { geoUtil = config.getGeoUtil(); geoConverter = config.getGeoConverter(); fieldTree = geoUtil.getBinaryTreeOrderedByBitMag(); geoRecordSerializer = new CartesianGeoRecordSerializer(); this.config = config; }
/** * Adds a record to the geo only index * * @param uuid * @param field */ public void index(byte[] uuid, GeoCoordinateField field) { if (uuid.length != config.getBytesForId()) { throw new IllegalArgumentException( "invalid uuid length: " + uuid.length + ". Expected uuid to be of length " + config.getBytesForId() + "."); } IGeoConverter converter = config.getGeoConverter(); GeoCoordinate geoCoordinate = field.getGeoCoordinate(); IDGeoRecord geoRecord = converter.toIDGeoRecord(geoCoordinate.getLatitude(), geoCoordinate.getLongitude(), uuid); newRecords.add(geoRecord); }
private GeoSegmentInfo buildGeoSegmentInfo(String segmentName) throws IOException { IGeoConverter converter = config.getGeoConverter(); // write version GeoSegmentInfo info = new GeoSegmentInfo(); info.setGeoVersion(GeoVersion.CURRENT_GEOONLY_VERSION); info.setSegmentName(segmentName); info.setBytesPerRecord(IDGeoRecordSerializer.INTERLACE_BYTES + config.getBytesForId()); // now write field -> filterByte mapping info IFieldNameFilterConverter fieldNameFilterConverter = converter.makeFieldNameFilterConverter(); if (fieldNameFilterConverter != null) { info.setFieldNameFilterConverter(fieldNameFilterConverter); } return info; }