diff --git a/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java b/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java index c8dbf516aa4..76feb98390c 100644 --- a/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java +++ b/contrib/spatial/src/java/org/apache/lucene/spatial/tier/CartesianShapeFilter.java @@ -36,12 +36,13 @@ import org.apache.lucene.util.OpenBitSet; */ 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){ diff --git a/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java b/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java index 412752717d2..df884012ed9 100644 --- a/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java +++ b/contrib/spatial/src/java/org/apache/lucene/spatial/tier/DistanceFilter.java @@ -19,6 +19,8 @@ package org.apache.lucene.spatial.tier; 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 @@ public abstract class DistanceFilter extends Filter { protected double distance; protected int nextDocBase; - protected final WeakHashMap distanceLookupCache; + protected transient WeakHashMap distanceLookupCache; /** Filters the startingFilter by precise distance * checking filter */ @@ -61,6 +63,12 @@ public abstract class DistanceFilter extends Filter { distanceLookupCache = new WeakHashMap(); } + /** needed for deserialization, because the cache is transient */ + private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { + stream.defaultReadObject(); + distanceLookupCache = new WeakHashMap(); + } + public Map getDistances(){ return distances; }