mirror of https://github.com/apache/lucene.git
SOLR-1568: moved DistanceUtils up one package, as it isn't tier specific
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@965984 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f521e84c5a
commit
f18502ed41
|
@ -15,13 +15,14 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.lucene.spatial.tier;
|
||||
package org.apache.lucene.spatial;
|
||||
|
||||
import org.apache.lucene.spatial.geometry.DistanceUnits;
|
||||
import org.apache.lucene.spatial.geometry.FloatLatLng;
|
||||
import org.apache.lucene.spatial.geometry.LatLng;
|
||||
import org.apache.lucene.spatial.geometry.shape.LLRect;
|
||||
import org.apache.lucene.spatial.geometry.shape.Rectangle;
|
||||
import org.apache.lucene.spatial.tier.InvalidGeoException;
|
||||
|
||||
/**
|
||||
* <p><font color="red"><b>NOTE:</b> This API is still in
|
||||
|
@ -312,9 +313,9 @@ public class DistanceUtils {
|
|||
* @param externalVal The value to parse
|
||||
* @param dimension The expected number of values for the point
|
||||
* @return An array of the values that make up the point (aka vector)
|
||||
* @throws InvalidGeoException if the dimension specified does not match the number of values in the externalValue.
|
||||
* @throws org.apache.lucene.spatial.tier.InvalidGeoException if the dimension specified does not match the number of values in the externalValue.
|
||||
*/
|
||||
public static String[] parsePoint(String[] out, String externalVal, int dimension) throws InvalidGeoException{
|
||||
public static String[] parsePoint(String[] out, String externalVal, int dimension) throws InvalidGeoException {
|
||||
//TODO: Should we support sparse vectors?
|
||||
if (out == null || out.length != dimension) out = new String[dimension];
|
||||
int idx = externalVal.indexOf(',');
|
|
@ -25,9 +25,9 @@ import org.apache.lucene.search.FieldCache.DocTerms;
|
|||
import org.apache.lucene.search.Filter;
|
||||
import org.apache.lucene.search.DocIdSet;
|
||||
import org.apache.lucene.search.FilteredDocIdSet;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.spatial.tier.DistanceFilter;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
|
||||
|
||||
/** <p><font color="red"><b>NOTE:</b> This API is still in
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.lucene.spatial.tier;
|
||||
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.search.FilteredDocIdSet;
|
|||
import org.apache.lucene.search.FieldCache;
|
||||
import org.apache.lucene.search.Filter;
|
||||
import org.apache.lucene.search.DocIdSet;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package org.apache.lucene.spatial.tier.projections;
|
||||
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
|
||||
/**
|
||||
* Based on Sinusoidal Projections
|
||||
* Project a latitude / longitude on a 2D cartesian map
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.apache.lucene.spatial;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.tier.InvalidGeoException;
|
||||
|
||||
|
||||
|
@ -180,7 +179,7 @@ public class DistanceUtilsTest extends TestCase {
|
|||
|
||||
|
||||
try {
|
||||
parse = org.apache.lucene.spatial.tier.DistanceUtils.parsePoint(null, "89.0 , ", 3);
|
||||
parse = DistanceUtils.parsePoint(null, "89.0 , ", 3);
|
||||
assertTrue(false);
|
||||
} catch (InvalidGeoException e) {
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
*/
|
||||
package org.apache.lucene.spatial.tier;
|
||||
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.apache.lucene.search.function.CustomScoreQuery;
|
|||
import org.apache.lucene.search.function.CustomScoreProvider;
|
||||
import org.apache.lucene.search.function.FieldScoreQuery;
|
||||
import org.apache.lucene.search.function.FieldScoreQuery.Type;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.lucene.spatial.geohash.GeoHashUtils;
|
||||
import org.apache.lucene.spatial.geometry.DistanceUnits;
|
||||
import org.apache.lucene.spatial.geometry.FloatLatLng;
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package org.apache.lucene.spatial.tier.projections;
|
||||
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.Assert.*;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.apache.lucene.document.Fieldable;
|
|||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.apache.lucene.spatial.geohash.GeoHashUtils;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.lucene.spatial.tier.InvalidGeoException;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.response.TextResponseWriter;
|
||||
|
@ -42,7 +42,7 @@ import java.io.IOException;
|
|||
* href="http://en.wikipedia.org/wiki/Geohash">Geohash</a> field. The field is
|
||||
* provided as a lat/lon pair and is internally represented as a string.
|
||||
*
|
||||
* @see org.apache.lucene.spatial.tier.DistanceUtils#parseLatitudeLongitude(double[], String)
|
||||
* @see org.apache.lucene.spatial.DistanceUtils#parseLatitudeLongitude(double[], String)
|
||||
*/
|
||||
public class GeoHashField extends FieldType implements SpatialQueryable {
|
||||
|
||||
|
|
|
@ -22,9 +22,8 @@ import org.apache.lucene.search.BooleanClause;
|
|||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.lucene.spatial.tier.InvalidGeoException;
|
||||
import org.apache.lucene.spatial.tier.projections.CartesianTierPlotter;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.response.TextResponseWriter;
|
||||
import org.apache.solr.response.XMLWriter;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.lucene.search.BooleanClause;
|
|||
import org.apache.lucene.search.BooleanQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.SortField;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.lucene.spatial.tier.InvalidGeoException;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.params.MapSolrParams;
|
||||
|
@ -201,8 +201,8 @@ public class PointType extends CoordinateFieldType implements SpatialQueryable {
|
|||
} else {
|
||||
BooleanQuery tmp = new BooleanQuery();
|
||||
//TODO: Handle distance measures, as this assumes Euclidean
|
||||
double [] ur = org.apache.lucene.spatial.tier.DistanceUtils.vectorBoxCorner(point, null, options.distance, true);
|
||||
double [] ll = org.apache.lucene.spatial.tier.DistanceUtils.vectorBoxCorner(point, null, options.distance, false);
|
||||
double [] ur = DistanceUtils.vectorBoxCorner(point, null, options.distance, true);
|
||||
double [] ll = DistanceUtils.vectorBoxCorner(point, null, options.distance, false);
|
||||
for (int i = 0; i < ur.length; i++) {
|
||||
SchemaField subSF = subField(options.field, i);
|
||||
Query range = subSF.getType().getRangeQuery(parser, subSF, String.valueOf(ll[i]), String.valueOf(ur[i]), true, true);
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.apache.solr.search;
|
|||
import org.apache.lucene.queryParser.ParseException;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.spatial.geometry.DistanceUnits;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.common.params.SolrParams;
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.apache.lucene.search.spell.JaroWinklerDistance;
|
|||
import org.apache.lucene.search.spell.LevensteinDistance;
|
||||
import org.apache.lucene.search.spell.NGramDistance;
|
||||
import org.apache.lucene.search.spell.StringDistance;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.apache.lucene.util.UnicodeUtil;
|
||||
import org.apache.solr.common.SolrException;
|
||||
|
|
|
@ -17,7 +17,7 @@ package org.apache.solr.search.function.distance;
|
|||
*/
|
||||
|
||||
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.solr.search.function.ValueSource;
|
||||
import org.apache.solr.search.function.DocValues;
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.solr.search.function.distance;
|
|||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.Searcher;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.search.function.MultiValueSource;
|
||||
import org.apache.solr.search.function.DocValues;
|
||||
|
|
|
@ -16,7 +16,7 @@ package org.apache.solr.search.function.distance;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.solr.search.function.DocValues;
|
||||
import org.apache.solr.search.function.MultiValueSource;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ package org.apache.solr.search.function.distance;
|
|||
|
||||
import org.apache.lucene.index.IndexReader;
|
||||
import org.apache.lucene.search.Searcher;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.apache.solr.search.function.DocValues;
|
||||
import org.apache.solr.search.function.MultiValueSource;
|
||||
|
|
|
@ -16,8 +16,8 @@ package org.apache.solr.search.function.distance;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.lucene.spatial.DistanceUtils;
|
||||
import org.apache.lucene.spatial.geohash.GeoHashUtils;
|
||||
import org.apache.lucene.spatial.tier.DistanceUtils;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.common.SolrException;
|
||||
import org.junit.BeforeClass;
|
||||
|
|
Loading…
Reference in New Issue