lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r730662 - in /lucene/java/trunk/contrib/spatial/src: java/org/apache/lucene/spatial/tier/ java/org/apache/lucene/spatial/tier/projections/ test/org/apache/lucene/spatial/tier/
Date Fri, 02 Jan 2009 03:21:23 GMT
Author: ryan
Date: Thu Jan  1 19:21:23 2009
New Revision: 730662

URL: http://svn.apache.org/viewvc?rev=730662&view=rev
Log:
LUCENE-1508 -- using the tierPrefix constructors by default

Modified:
    lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java
    lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQueryBuilder.java
    lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/projections/CartesianTierPlotter.java
    lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java
    lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java

Modified: lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java?rev=730662&r1=730661&r2=730662&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java
(original)
+++ lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianPolyFilterBuilder.java
Thu Jan  1 19:21:23 2009
@@ -36,6 +36,12 @@
   private IProjector projector = new SinusoidalProjector();
   private Logger log = Logger.getLogger(getClass().getName());
   
+  private final String tierPrefix;
+  
+  public CartesianPolyFilterBuilder( String tierPrefix ) {
+    this.tierPrefix = tierPrefix;
+  }
+  
   public Shape getBoxShape(double latitude, double longitude, int miles)
   {  
     Rectangle box = DistanceUtils.getInstance().getBoundary(latitude, longitude, miles);
@@ -46,11 +52,11 @@
     double longY = box.getMaxPoint().getX(); ///box.getX();
     double longX = box.getMinPoint().getX();//box.getMaxX();
     
-    CartesianTierPlotter ctp = new CartesianTierPlotter(2, projector);
+    CartesianTierPlotter ctp = new CartesianTierPlotter(2, projector,tierPrefix);
     int bestFit = ctp.bestFit(miles);
     
     log.info("Best Fit is : " + bestFit);
-    ctp = new CartesianTierPlotter(bestFit, projector);
+    ctp = new CartesianTierPlotter(bestFit, projector,tierPrefix);
     Shape shape = new Shape(ctp.getTierFieldName());
     
     // generate shape

Modified: lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQueryBuilder.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQueryBuilder.java?rev=730662&r1=730661&r2=730662&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQueryBuilder.java
(original)
+++ lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceQueryBuilder.java
Thu Jan  1 19:21:23 2009
@@ -47,14 +47,15 @@
    * @param lng
    * @param miles
    */
-  public DistanceQueryBuilder (double lat, double lng, double miles, String latField, String
lngField, boolean needPrecise){
+  public DistanceQueryBuilder (double lat, double lng, double miles, 
+      String latField, String lngField, String tierFieldPrefix, boolean needPrecise){
 
     this.lat = lat;
     this.lng = lng;
     this.miles = miles;
     
     
-    CartesianPolyFilterBuilder cpf = new CartesianPolyFilterBuilder();
+    CartesianPolyFilterBuilder cpf = new CartesianPolyFilterBuilder(tierFieldPrefix);
     cartesianFilter = cpf.getBoundingArea(lat, lng, (int)miles);
 
     /* create precise distance filter */

Modified: lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/projections/CartesianTierPlotter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/projections/CartesianTierPlotter.java?rev=730662&r1=730661&r2=730662&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/projections/CartesianTierPlotter.java
(original)
+++ lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/projections/CartesianTierPlotter.java
Thu Jan  1 19:21:23 2009
@@ -21,6 +21,7 @@
  * 
  */
 public class CartesianTierPlotter {
+  public static final String DEFALT_FIELD_PREFIX = "_tier_";
   
   final int tierLevel;
   int tierLength;
@@ -40,10 +41,6 @@
     setTierBoxes();
     setTierVerticalPosDivider();
   }
-
-  public CartesianTierPlotter (int tierLevel, IProjector projector) {
-    this( tierLevel, projector, "_localTier" );
-  }
   
   private void setTierLength (){
     this.tierLength = (int) Math.pow(2 , this.tierLevel);

Modified: lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java?rev=730662&r1=730661&r2=730662&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java
(original)
+++ lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/PolyShape.java
Thu Jan  1 19:21:23 2009
@@ -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 mil
 es = 1000;
  /**
   * @param args
   */
  public static void main(String[] args) {
  
  
 CartesianPolyFilterBuilder cpf = new CartesianPolyFilterBuilder();
    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 mil
 es = 1000;
  /**
   * @param args
   */
  public static void main(String[] args) {
  
  
 CartesianPolyFilterBuilder cpf = new CartesianPolyFilterBuilder( "_localTier" );
    cpf.getBoxShape(lat,
lng, miles);
    
  }

}
\ No newline at end of file

Modified: lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java?rev=730662&r1=730661&r2=730662&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
(original)
+++ lucene/java/trunk/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
Thu Jan  1 19:21:23 2009
@@ -88,8 +88,8 @@
   private void setUpPlotter(int base, int top) {
     
     for (; base <= top; base ++){
-      ctps.add(new CartesianTierPlotter(base,project ));
-    
+      ctps.add(new CartesianTierPlotter(base,project,
+          CartesianTierPlotter.DEFALT_FIELD_PREFIX));
     }
   }
   
@@ -149,7 +149,8 @@
     final double miles = 6.0;
     
     // create a distance query
-    final DistanceQueryBuilder dq = new DistanceQueryBuilder(lat, lng, miles, latField, lngField,
true);
+    final DistanceQueryBuilder dq = new DistanceQueryBuilder(lat, lng, miles, 
+        latField, lngField, CartesianTierPlotter.DEFALT_FIELD_PREFIX, true);
      
     System.out.println(dq);
     //create a term query to search against all documents



Mime
View raw message