LUCENE-1737: set up FieldInfos correctly the when we open a pre-4.0 index

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1050790 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-12-19 10:17:50 +00:00
parent b5726a4267
commit 89d6a37d48
2 changed files with 4 additions and 4 deletions

View File

@ -830,7 +830,7 @@ public class IndexWriter implements Closeable {
private FieldInfos getCurrentFieldInfos() throws IOException { private FieldInfos getCurrentFieldInfos() throws IOException {
final FieldInfos fieldInfos; final FieldInfos fieldInfos;
if (segmentInfos.size() > 0) { if (segmentInfos.size() > 0) {
if (segmentInfos.getFormat() > DefaultSegmentInfosWriter.FORMAT_4_0) { if (segmentInfos.getFormat() > DefaultSegmentInfosWriter.FORMAT_HAS_VECTORS) {
// Pre-4.0 index. In this case we sweep all // Pre-4.0 index. In this case we sweep all
// segments, merging their FieldInfos: // segments, merging their FieldInfos:
fieldInfos = new FieldInfos(); fieldInfos = new FieldInfos();

View File

@ -35,13 +35,13 @@ public class DefaultSegmentInfosWriter extends SegmentInfosWriter {
* diagnostics storage, and switches userData to Map */ * diagnostics storage, and switches userData to Map */
public static final int FORMAT_DIAGNOSTICS = -9; public static final int FORMAT_DIAGNOSTICS = -9;
/** Each segment records whether it has term vectors */
public static final int FORMAT_HAS_VECTORS = -10;
/** Each segment records whether its postings are written /** Each segment records whether its postings are written
* in the new flex format */ * in the new flex format */
public static final int FORMAT_4_0 = -11; public static final int FORMAT_4_0 = -11;
/** Each segment records whether it has term vectors */
public static final int FORMAT_HAS_VECTORS = -10;
/** This must always point to the most recent file format. /** This must always point to the most recent file format.
* whenever you add a new format, make it 1 smaller (negative version logic)! */ * whenever you add a new format, make it 1 smaller (negative version logic)! */
public static final int FORMAT_CURRENT = FORMAT_4_0; public static final int FORMAT_CURRENT = FORMAT_4_0;