Skip to content

Apache Lucene open-source search software

LUCENE-1503 -- refactor spatial Query/Filter classes

Ryan McKinley0afd451f24dd
diff --git a/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilter.java b/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java
similarity index 98%
rename from contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilter.java
rename to contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java
index 8fc4086e9d4..24ffe7dff0d 100644
--- a/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilter.java
+++ b/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java
@@ -31,7 +31,7 @@ import org.apache.lucene.spatial.tier.projections.SinusoidalProjector;
/**
*
*/
-public class CartesianPolyFilter {
+public class CartesianPolyFilterBuilder {
private IProjector projector = new SinusoidalProjector();
private Logger log = Logger.getLogger(getClass().getName());
diff --git a/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQuery.java b/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQueryBuilder.java
similarity index 92%
rename from contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQuery.java
rename to contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQueryBuilder.java
index 9ac0e21abd3..b197f090c6b 100644
--- a/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQuery.java
+++ b/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQueryBuilder.java
@@ -24,7 +24,7 @@ import org.apache.lucene.search.QueryWrapperFilter;
import org.apache.lucene.spatial.SerialChainFilter;
-public class DistanceQuery {
+public class DistanceQueryBuilder {
private static final long serialVersionUID = 1L;
@@ -47,14 +47,14 @@ public class DistanceQuery {
* @param lng
* @param miles
*/
- public DistanceQuery (double lat, double lng, double miles, String latField, String lngField, boolean needPrecise){
+ public DistanceQueryBuilder (double lat, double lng, double miles, String latField, String lngField, boolean needPrecise){
this.lat = lat;
this.lng = lng;
this.miles = miles;
- CartesianPolyFilter cpf = new CartesianPolyFilter();
+ CartesianPolyFilterBuilder cpf = new CartesianPolyFilterBuilder();
cartesianFilter = cpf.getBoundingArea(lat, lng, (int)miles);
/* create precise distance filter */
diff --git a/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java b/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java
index b65cc2c5558..9bb8a80191b 100644
--- a/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java
+++ b/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java
@@ -1 +1 @@
-/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.lucene.spatial.tier; /** * */ public class PolyShape { private static double lat = 38.969398; private static double lng= -77.386398; private static int miles = 1000; /** * @param args */ public static void main(String[] args) { CartesianPolyFilter cpf = new CartesianPolyFilter(); cpf.getBoxShape(lat, lng, miles); } }
\ No newline at end of file
+/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.lucene.spatial.tier; /** * */ public class PolyShape { private static double lat = 38.969398; private static double lng= -77.386398; private static int miles = 1000; /** * @param args */ public static void main(String[] args) { CartesianPolyFilterBuilder cpf = new CartesianPolyFilterBuilder(); cpf.getBoxShape(lat, lng, miles); } }
\ No newline at end of file
diff --git a/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java b/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
index d53a7de96c6..d17141191fb 100644
--- a/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
+++ b/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
@@ -35,7 +35,7 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.spatial.tier.DistanceQuery;
+import org.apache.lucene.spatial.tier.DistanceQueryBuilder;
import org.apache.lucene.spatial.tier.DistanceSortSource;
import org.apache.lucene.spatial.tier.DistanceUtils;
import org.apache.lucene.spatial.tier.InvalidGeoException;
@@ -149,7 +149,7 @@ public class TestCartesian extends TestCase{
final double miles = 6.0;
// create a distance query
- final DistanceQuery dq = new DistanceQuery(lat, lng, miles, latField, lngField, true);
+ final DistanceQueryBuilder dq = new DistanceQueryBuilder(lat, lng, miles, latField, lngField, true);
System.out.println(dq);
//create a term query to search against all documents
diff --git a/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java b/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
index e45cfc592b1..69f9b7ced1b 100644
--- a/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
+++ b/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
@@ -32,7 +32,7 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.spatial.tier.DistanceQuery;
+import org.apache.lucene.spatial.tier.DistanceQueryBuilder;
import org.apache.lucene.spatial.tier.DistanceSortSource;
import org.apache.lucene.spatial.tier.DistanceUtils;
import org.apache.lucene.spatial.tier.InvalidGeoException;