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

@ -126,6 +126,7 @@ Bug fixes
14. LUCENE-650: Fixed NPE in Locale specific String Sort when Document 14. LUCENE-650: Fixed NPE in Locale specific String Sort when Document
has no value. has no value.
(Oliver Hutchison via Chris Hostetter) (Oliver Hutchison via Chris Hostetter)
Optimizations Optimizations
@ -153,6 +154,9 @@ Optimizations
in the presence of deleted docs or partially full segments as well as in the presence of deleted docs or partially full segments as well as
enabling future optimizations. (Ning Li, Yonik Seeley) enabling future optimizations. (Ning Li, Yonik Seeley)
7. Lazy loaded fields unnecessarily retained an extra copy of loaded
String data. (Yonik Seeley)
Test Cases Test Cases
1. Added TestTermScorer.java (Grant Ingersoll) 1. Added TestTermScorer.java (Grant Ingersoll)

View File

@ -265,9 +265,6 @@ final class FieldsReader {
private class LazyField extends AbstractField implements Fieldable { private class LazyField extends AbstractField implements Fieldable {
private int toRead; private int toRead;
private long pointer; private long pointer;
//internal buffer
private char[] chars;
public LazyField(String name, Field.Store store, int toRead, long pointer) { public LazyField(String name, Field.Store store, int toRead, long pointer) {
super(name, store, Field.Index.NO, Field.TermVector.NO); super(name, store, Field.Index.NO, Field.TermVector.NO);
@ -337,10 +334,9 @@ final class FieldsReader {
try { try {
localFieldsStream.seek(pointer); localFieldsStream.seek(pointer);
//read in chars b/c we already know the length we need to read //read in chars b/c we already know the length we need to read
if (chars == null || toRead > chars.length) char[] chars = new char[toRead];
chars = new char[toRead];
localFieldsStream.readChars(chars, 0, toRead); localFieldsStream.readChars(chars, 0, toRead);
fieldsData = new String(chars, 0, toRead);//fieldsStream.readString(); fieldsData = new String(chars);
} catch (IOException e) { } catch (IOException e) {
throw new FieldReaderException(e); throw new FieldReaderException(e);
} }