remove LazyField.chars to reduce memory consumption

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@454434 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2006-10-09 17:26:49 +00:00
parent efab233ed8
commit 0d4e1b171d
2 changed files with 6 additions and 6 deletions

View File

@ -127,6 +127,7 @@ Bug fixes
has no value.
(Oliver Hutchison via Chris Hostetter)
Optimizations
1. LUCENE-586: TermDocs.skipTo() is now more efficient for multi-segment
@ -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)

View File

@ -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);
}