mirror of https://github.com/apache/lucene.git
- Fixed a bug when dealing with large indices
- Added Javadoc. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c3bae8805b
commit
eeb4099cfa
|
@ -61,20 +61,25 @@ import org.apache.lucene.store.InputStream;
|
||||||
import org.apache.lucene.document.Document;
|
import org.apache.lucene.document.Document;
|
||||||
import org.apache.lucene.document.Field;
|
import org.apache.lucene.document.Field;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class responsible for access to stored document fields.
|
||||||
|
* It uses <segment>.fdt and <segment>.fdx; files.
|
||||||
|
*
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
final class FieldsReader {
|
final class FieldsReader {
|
||||||
private FieldInfos fieldInfos;
|
private FieldInfos fieldInfos;
|
||||||
private InputStream fieldsStream;
|
private InputStream fieldsStream;
|
||||||
private InputStream indexStream;
|
private InputStream indexStream;
|
||||||
private int size;
|
private int size;
|
||||||
|
|
||||||
FieldsReader(Directory d, String segment, FieldInfos fn)
|
FieldsReader(Directory d, String segment, FieldInfos fn) throws IOException {
|
||||||
throws IOException {
|
|
||||||
fieldInfos = fn;
|
fieldInfos = fn;
|
||||||
|
|
||||||
fieldsStream = d.openFile(segment + ".fdt");
|
fieldsStream = d.openFile(segment + ".fdt");
|
||||||
indexStream = d.openFile(segment + ".fdx");
|
indexStream = d.openFile(segment + ".fdx");
|
||||||
|
|
||||||
size = (int)indexStream.length() / 8;
|
size = (int)(indexStream.length() / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
final void close() throws IOException {
|
final void close() throws IOException {
|
||||||
|
@ -90,7 +95,7 @@ final class FieldsReader {
|
||||||
indexStream.seek(n * 8L);
|
indexStream.seek(n * 8L);
|
||||||
long position = indexStream.readLong();
|
long position = indexStream.readLong();
|
||||||
fieldsStream.seek(position);
|
fieldsStream.seek(position);
|
||||||
|
|
||||||
Document doc = new Document();
|
Document doc = new Document();
|
||||||
int numFields = fieldsStream.readVInt();
|
int numFields = fieldsStream.readVInt();
|
||||||
for (int i = 0; i < numFields; i++) {
|
for (int i = 0; i < numFields; i++) {
|
||||||
|
|
Loading…
Reference in New Issue