mirror of https://github.com/apache/lucene.git
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/lucene-solr
This commit is contained in:
commit
eb8751256d
|
@ -1,10 +1,10 @@
|
|||
<component name="libraryTable">
|
||||
<library name="JUnit">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/junit-4.10.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lucene/test-framework/lib/randomizedtesting-runner-2.3.2.jar!/" />
|
||||
<root url="file://$PROJECT_DIR$/lucene/test-framework/lib" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
<jarDirectory url="file://$PROJECT_DIR$/lucene/test-framework/lib" recursive="false" />
|
||||
</library>
|
||||
</component>
|
|
@ -341,7 +341,9 @@ public class TestBackwardsCompatibility extends LuceneTestCase {
|
|||
"5.4.1-cfs",
|
||||
"5.4.1-nocfs",
|
||||
"5.5.0-cfs",
|
||||
"5.5.0-nocfs"
|
||||
"5.5.0-nocfs",
|
||||
"6.0.0-cfs",
|
||||
"6.0.0-nocfs"
|
||||
};
|
||||
|
||||
// TODO: on 6.0.0 release, gen the single segment indices and add here:
|
||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -31,9 +31,8 @@ import org.apache.lucene.geo.GeoUtils;
|
|||
* circle. Terms
|
||||
* passing this initial filter are then passed to a secondary {@code postFilter} method that verifies whether the
|
||||
* decoded lat/lon point fall within the specified query distance (see {@link org.apache.lucene.util.SloppyMath#haversinMeters(double, double, double, double)}.
|
||||
* All morton value comparisons are subject to the same precision tolerance defined in
|
||||
* {@value org.apache.lucene.spatial.util.GeoEncodingUtils#TOLERANCE} and distance comparisons are subject to the accuracy of the
|
||||
* haversine formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159)
|
||||
* Distance comparisons are subject to the accuracy of the haversine formula
|
||||
* (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159)
|
||||
*
|
||||
* <p>Note: This query currently uses haversine which is a sloppy distance calculation (see above reference). For large
|
||||
* queries one can expect upwards of 400m error. Vincenty shrinks this to ~40m error but pays a penalty for computing
|
||||
|
|
|
@ -31,8 +31,6 @@ import org.apache.lucene.geo.GeoUtils;
|
|||
* range based on the morton codes of the min and max lat/lon pairs. Terms
|
||||
* passing this initial filter are passed to a final check that verifies whether
|
||||
* the decoded lat/lon falls within (or on the boundary) of the query bounding box.
|
||||
* The value comparisons are subject to a precision tolerance defined in
|
||||
* {@value org.apache.lucene.spatial.util.GeoEncodingUtils#TOLERANCE}
|
||||
*
|
||||
* NOTES:
|
||||
* 1. All latitude/longitude values must be in decimal degrees.
|
||||
|
|
|
@ -33,8 +33,7 @@ import org.apache.lucene.geo.Polygon;
|
|||
* of the min and max lat/lon pairs. Terms passing this initial filter are passed
|
||||
* to a secondary filter that verifies whether the decoded lat/lon point falls within
|
||||
* (or on the boundary) of the bounding box query. Finally, the remaining candidate
|
||||
* term is passed to the final point in polygon check. All value comparisons are subject
|
||||
* to the same precision tolerance defined in {@value GeoEncodingUtils#TOLERANCE}
|
||||
* term is passed to the final point in polygon check.
|
||||
*
|
||||
* @see Polygon
|
||||
* @lucene.experimental
|
||||
|
|
|
@ -41,10 +41,7 @@ public final class GeoEncodingUtils {
|
|||
* for encoding <code>geoEncoded</code> values.
|
||||
* @see #geoCodedToPrefixCodedBytes(long, int, BytesRefBuilder)
|
||||
*/
|
||||
public static final int BUF_SIZE_LONG = 28/8 + 1;
|
||||
|
||||
/** rounding error for quantized latitude and longitude values */
|
||||
public static final double TOLERANCE = 1E-6;
|
||||
private static final int BUF_SIZE_LONG = 28/8 + 1;
|
||||
|
||||
// No instance:
|
||||
private GeoEncodingUtils() {
|
||||
|
@ -91,8 +88,12 @@ public final class GeoEncodingUtils {
|
|||
|
||||
/** Convert a prefix coded geo term back into the geocoded morton long */
|
||||
public static long prefixCodedToGeoCoded(final BytesRef val) {
|
||||
final long result = fromBytes((byte)0, (byte)0, (byte)0, (byte)0,
|
||||
val.bytes[val.offset+0], val.bytes[val.offset+1], val.bytes[val.offset+2], val.bytes[val.offset+3]);
|
||||
final long result = 0L
|
||||
| (val.bytes[val.offset+0] & 255L) << 24
|
||||
| (val.bytes[val.offset+1] & 255L) << 16
|
||||
| (val.bytes[val.offset+2] & 255L) << 8
|
||||
| val.bytes[val.offset+3] & 255L;
|
||||
|
||||
return result << 32;
|
||||
}
|
||||
|
||||
|
@ -130,13 +131,6 @@ public final class GeoEncodingUtils {
|
|||
return shift;
|
||||
}
|
||||
|
||||
/** Converts 8 bytes to a long value */
|
||||
protected static long fromBytes(byte b1, byte b2, byte b3, byte b4, byte b5, byte b6, byte b7, byte b8) {
|
||||
return ((long)b1 & 255L) << 56 | ((long)b2 & 255L) << 48 | ((long)b3 & 255L) << 40
|
||||
| ((long)b4 & 255L) << 32 | ((long)b5 & 255L) << 24 | ((long)b6 & 255L) << 16
|
||||
| ((long)b7 & 255L) << 8 | (long)b8 & 255L;
|
||||
}
|
||||
|
||||
/** Converts a long value into a bit string (useful for debugging) */
|
||||
public static String geoTermToString(long term) {
|
||||
StringBuilder s = new StringBuilder(64);
|
||||
|
|
|
@ -61,8 +61,9 @@ public class TestGeoEncodingUtils extends LuceneTestCase {
|
|||
double latEnc = GeoEncodingUtils.mortonUnhashLat(enc);
|
||||
double lonEnc = GeoEncodingUtils.mortonUnhashLon(enc);
|
||||
|
||||
assertEquals("lat=" + lat + " latEnc=" + latEnc + " diff=" + (lat - latEnc), lat, latEnc, GeoEncodingUtils.TOLERANCE);
|
||||
assertEquals("lon=" + lon + " lonEnc=" + lonEnc + " diff=" + (lon - lonEnc), lon, lonEnc, GeoEncodingUtils.TOLERANCE);
|
||||
// todo remove tolerance
|
||||
assertEquals("lat=" + lat + " latEnc=" + latEnc + " diff=" + (lat - latEnc), lat, latEnc, 1e-6);
|
||||
assertEquals("lon=" + lon + " lonEnc=" + lonEnc + " diff=" + (lon - lonEnc), lon, lonEnc, 1e-6);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue