lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r832987 - in /lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier: CartesianShapeFilter.java DistanceFilter.java
Date Thu, 05 Nov 2009 03:43:03 GMT
Author: uschindler
Date: Thu Nov  5 03:43:02 2009
New Revision: 832987

URL: http://svn.apache.org/viewvc?rev=832987&view=rev
Log:
LUCENE-2032: Spatial Filter is now correctly Serializable

Modified:
    lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java
    lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java

Modified: lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java?rev=832987&r1=832986&r2=832987&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java
(original)
+++ lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java
Thu Nov  5 03:43:02 2009
@@ -36,12 +36,13 @@
  */
 public class CartesianShapeFilter extends Filter {
 
+  private static final Logger log = Logger.getLogger(CartesianShapeFilter.class.getName());
+
   /**
    * 
    */
   private static final long serialVersionUID = 1L;
   private Shape shape;
-  private Logger log = Logger.getLogger(getClass().getName());
   private String fieldName;
   
   CartesianShapeFilter(Shape shape, String fieldName){

Modified: lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java?rev=832987&r1=832986&r2=832987&view=diff
==============================================================================
--- lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java
(original)
+++ lucene/java/trunk/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java
Thu Nov  5 03:43:02 2009
@@ -19,6 +19,8 @@
 import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.HashMap;
+import java.io.IOException;
+import java.io.ObjectInputStream;
 
 import org.apache.lucene.search.Filter;
 import org.apache.lucene.spatial.tier.DistanceHandler.Precision;
@@ -36,7 +38,7 @@
   protected double distance;
 
   protected int nextDocBase; 
-  protected final WeakHashMap<String,Double> distanceLookupCache;
+  protected transient WeakHashMap<String,Double> distanceLookupCache;
 
   /** Filters the startingFilter by precise distance
    *  checking filter */
@@ -61,6 +63,12 @@
     distanceLookupCache = new WeakHashMap<String,Double>();
   }
 
+  /** needed for deserialization, because the cache is transient */
+  private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException
{
+    stream.defaultReadObject();
+    distanceLookupCache = new WeakHashMap<String,Double>();
+  }
+
   public Map<Integer,Double> getDistances(){
     return distances;
   }



Mime
View raw message