diff --git a/src/java/org/apache/lucene/search/NumericRangeQuery.java b/src/java/org/apache/lucene/search/NumericRangeQuery.java index b30892e4391..789538c33ee 100644 --- a/src/java/org/apache/lucene/search/NumericRangeQuery.java +++ b/src/java/org/apache/lucene/search/NumericRangeQuery.java @@ -363,8 +363,14 @@ public final class NumericRangeQuery extends MultiTermQuery { (Boolean.valueOf(maxInclusive).hashCode()^0x733fa5fe); } + // field must be interned after reading from stream + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + in.defaultReadObject(); + field = StringHelper.intern(field); + } + // members (package private, to be also fast accessible by NumericRangeTermEnum) - final String field; + String field; final int precisionStep, valSize; final T min, max; final boolean minInclusive,maxInclusive; diff --git a/src/java/org/apache/lucene/search/SortField.java b/src/java/org/apache/lucene/search/SortField.java index a78d4a1f192..eac4dfa00d5 100644 --- a/src/java/org/apache/lucene/search/SortField.java +++ b/src/java/org/apache/lucene/search/SortField.java @@ -354,6 +354,11 @@ implements Serializable { return hash; } + // field must be interned after reading from stream + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + in.defaultReadObject(); + field = StringHelper.intern(field); + } /** Returns the {@link FieldComparator} to use for * sorting.