diff --git a/CHANGES.txt b/CHANGES.txt index 7059234a40b..0b96235e3ca 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -126,6 +126,7 @@ Bug fixes 14. LUCENE-650: Fixed NPE in Locale specific String Sort when Document has no value. (Oliver Hutchison via Chris Hostetter) + Optimizations @@ -153,6 +154,9 @@ Optimizations in the presence of deleted docs or partially full segments as well as enabling future optimizations. (Ning Li, Yonik Seeley) + 7. Lazy loaded fields unnecessarily retained an extra copy of loaded + String data. (Yonik Seeley) + Test Cases 1. Added TestTermScorer.java (Grant Ingersoll) diff --git a/src/java/org/apache/lucene/index/FieldsReader.java b/src/java/org/apache/lucene/index/FieldsReader.java index 992bd2cebce..1ec1d484c98 100644 --- a/src/java/org/apache/lucene/index/FieldsReader.java +++ b/src/java/org/apache/lucene/index/FieldsReader.java @@ -265,9 +265,6 @@ final class FieldsReader { private class LazyField extends AbstractField implements Fieldable { private int toRead; private long pointer; - //internal buffer - private char[] chars; - public LazyField(String name, Field.Store store, int toRead, long pointer) { super(name, store, Field.Index.NO, Field.TermVector.NO); @@ -337,10 +334,9 @@ final class FieldsReader { try { localFieldsStream.seek(pointer); //read in chars b/c we already know the length we need to read - if (chars == null || toRead > chars.length) - chars = new char[toRead]; + char[] chars = new char[toRead]; localFieldsStream.readChars(chars, 0, toRead); - fieldsData = new String(chars, 0, toRead);//fieldsStream.readString(); + fieldsData = new String(chars); } catch (IOException e) { throw new FieldReaderException(e); }