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:
Grant Ingersoll 2010-07-20 20:17:54 +00:00
parent f521e84c5a
commit f18502ed41
19 changed files with 25 additions and 25 deletions

View File

@ -15,13 +15,14 @@
* limitations under the License. * 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.DistanceUnits;
import org.apache.lucene.spatial.geometry.FloatLatLng; import org.apache.lucene.spatial.geometry.FloatLatLng;
import org.apache.lucene.spatial.geometry.LatLng; import org.apache.lucene.spatial.geometry.LatLng;
import org.apache.lucene.spatial.geometry.shape.LLRect; import org.apache.lucene.spatial.geometry.shape.LLRect;
import org.apache.lucene.spatial.geometry.shape.Rectangle; 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 * <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 externalVal The value to parse
* @param dimension The expected number of values for the point * @param dimension The expected number of values for the point
* @return An array of the values that make up the point (aka vector) * @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? //TODO: Should we support sparse vectors?
if (out == null || out.length != dimension) out = new String[dimension]; if (out == null || out.length != dimension) out = new String[dimension];
int idx = externalVal.indexOf(','); int idx = externalVal.indexOf(',');

View File

@ -25,9 +25,9 @@ import org.apache.lucene.search.FieldCache.DocTerms;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;
import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.FilteredDocIdSet; import org.apache.lucene.search.FilteredDocIdSet;
import org.apache.lucene.spatial.DistanceUtils;
import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRef;
import org.apache.lucene.spatial.tier.DistanceFilter; 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 /** <p><font color="red"><b>NOTE:</b> This API is still in

View File

@ -17,6 +17,8 @@
package org.apache.lucene.spatial.tier; package org.apache.lucene.spatial.tier;
import org.apache.lucene.spatial.DistanceUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@ -23,6 +23,7 @@ import org.apache.lucene.search.FilteredDocIdSet;
import org.apache.lucene.search.FieldCache; import org.apache.lucene.search.FieldCache;
import org.apache.lucene.search.Filter; import org.apache.lucene.search.Filter;
import org.apache.lucene.search.DocIdSet; import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.spatial.DistanceUtils;
/** /**

View File

@ -17,8 +17,6 @@
package org.apache.lucene.spatial.tier.projections; package org.apache.lucene.spatial.tier.projections;
import org.apache.lucene.spatial.tier.DistanceUtils;
/** /**
* Based on Sinusoidal Projections * Based on Sinusoidal Projections
* Project a latitude / longitude on a 2D cartesian map * Project a latitude / longitude on a 2D cartesian map

View File

@ -1,7 +1,6 @@
package org.apache.lucene.spatial; package org.apache.lucene.spatial;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.lucene.spatial.tier.DistanceUtils;
import org.apache.lucene.spatial.tier.InvalidGeoException; import org.apache.lucene.spatial.tier.InvalidGeoException;
@ -180,7 +179,7 @@ public class DistanceUtilsTest extends TestCase {
try { try {
parse = org.apache.lucene.spatial.tier.DistanceUtils.parsePoint(null, "89.0 , ", 3); parse = DistanceUtils.parsePoint(null, "89.0 , ", 3);
assertTrue(false); assertTrue(false);
} catch (InvalidGeoException e) { } catch (InvalidGeoException e) {
} }

View File

@ -16,6 +16,8 @@
*/ */
package org.apache.lucene.spatial.tier; package org.apache.lucene.spatial.tier;
import org.apache.lucene.spatial.DistanceUtils;
import java.text.DecimalFormat; import java.text.DecimalFormat;

View File

@ -40,6 +40,7 @@ import org.apache.lucene.search.function.CustomScoreQuery;
import org.apache.lucene.search.function.CustomScoreProvider; import org.apache.lucene.search.function.CustomScoreProvider;
import org.apache.lucene.search.function.FieldScoreQuery; import org.apache.lucene.search.function.FieldScoreQuery;
import org.apache.lucene.search.function.FieldScoreQuery.Type; 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.geohash.GeoHashUtils;
import org.apache.lucene.spatial.geometry.DistanceUnits; import org.apache.lucene.spatial.geometry.DistanceUnits;
import org.apache.lucene.spatial.geometry.FloatLatLng; import org.apache.lucene.spatial.geometry.FloatLatLng;

View File

@ -1,10 +1,7 @@
package org.apache.lucene.spatial.tier.projections; package org.apache.lucene.spatial.tier.projections;
import org.apache.lucene.spatial.tier.DistanceUtils;
import org.junit.Test; import org.junit.Test;
import static junit.framework.Assert.*;
/** /**
* *

View File

@ -21,7 +21,7 @@ import org.apache.lucene.document.Fieldable;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.SortField; import org.apache.lucene.search.SortField;
import org.apache.lucene.spatial.geohash.GeoHashUtils; 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.lucene.spatial.tier.InvalidGeoException;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.response.TextResponseWriter; 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 * 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. * 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 { public class GeoHashField extends FieldType implements SpatialQueryable {

View File

@ -22,9 +22,8 @@ import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.SortField; 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.InvalidGeoException;
import org.apache.lucene.spatial.tier.projections.CartesianTierPlotter;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.response.TextResponseWriter; import org.apache.solr.response.TextResponseWriter;
import org.apache.solr.response.XMLWriter; import org.apache.solr.response.XMLWriter;

View File

@ -23,7 +23,7 @@ import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.SortField; 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.InvalidGeoException;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.MapSolrParams; import org.apache.solr.common.params.MapSolrParams;
@ -201,8 +201,8 @@ public class PointType extends CoordinateFieldType implements SpatialQueryable {
} else { } else {
BooleanQuery tmp = new BooleanQuery(); BooleanQuery tmp = new BooleanQuery();
//TODO: Handle distance measures, as this assumes Euclidean //TODO: Handle distance measures, as this assumes Euclidean
double [] ur = org.apache.lucene.spatial.tier.DistanceUtils.vectorBoxCorner(point, null, options.distance, true); double [] ur = DistanceUtils.vectorBoxCorner(point, null, options.distance, true);
double [] ll = org.apache.lucene.spatial.tier.DistanceUtils.vectorBoxCorner(point, null, options.distance, false); double [] ll = DistanceUtils.vectorBoxCorner(point, null, options.distance, false);
for (int i = 0; i < ur.length; i++) { for (int i = 0; i < ur.length; i++) {
SchemaField subSF = subField(options.field, i); SchemaField subSF = subField(options.field, i);
Query range = subSF.getType().getRangeQuery(parser, subSF, String.valueOf(ll[i]), String.valueOf(ur[i]), true, true); Query range = subSF.getType().getRangeQuery(parser, subSF, String.valueOf(ll[i]), String.valueOf(ur[i]), true, true);

View File

@ -20,7 +20,7 @@ package org.apache.solr.search;
import org.apache.lucene.queryParser.ParseException; import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.spatial.geometry.DistanceUnits; 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.SolrException;
import org.apache.solr.common.params.CommonParams; import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.params.SolrParams;

View File

@ -26,7 +26,7 @@ import org.apache.lucene.search.spell.JaroWinklerDistance;
import org.apache.lucene.search.spell.LevensteinDistance; import org.apache.lucene.search.spell.LevensteinDistance;
import org.apache.lucene.search.spell.NGramDistance; import org.apache.lucene.search.spell.NGramDistance;
import org.apache.lucene.search.spell.StringDistance; 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.BytesRef;
import org.apache.lucene.util.UnicodeUtil; import org.apache.lucene.util.UnicodeUtil;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;

View File

@ -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.ValueSource;
import org.apache.solr.search.function.DocValues; import org.apache.solr.search.function.DocValues;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;

View File

@ -18,7 +18,7 @@ package org.apache.solr.search.function.distance;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Searcher; 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.common.SolrException;
import org.apache.solr.search.function.MultiValueSource; import org.apache.solr.search.function.MultiValueSource;
import org.apache.solr.search.function.DocValues; import org.apache.solr.search.function.DocValues;

View File

@ -16,7 +16,7 @@ package org.apache.solr.search.function.distance;
* limitations under the License. * 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.DocValues;
import org.apache.solr.search.function.MultiValueSource; import org.apache.solr.search.function.MultiValueSource;

View File

@ -18,7 +18,7 @@ package org.apache.solr.search.function.distance;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Searcher; 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.common.SolrException;
import org.apache.solr.search.function.DocValues; import org.apache.solr.search.function.DocValues;
import org.apache.solr.search.function.MultiValueSource; import org.apache.solr.search.function.MultiValueSource;

View File

@ -16,8 +16,8 @@ package org.apache.solr.search.function.distance;
* limitations under the License. * limitations under the License.
*/ */
import org.apache.lucene.spatial.DistanceUtils;
import org.apache.lucene.spatial.geohash.GeoHashUtils; import org.apache.lucene.spatial.geohash.GeoHashUtils;
import org.apache.lucene.spatial.tier.DistanceUtils;
import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.junit.BeforeClass; import org.junit.BeforeClass;