Skip to content

Commit 6e31623

Browse files
committed
update after review
1 parent 1cf1afc commit 6e31623

File tree

3 files changed

+11
-88
lines changed

3 files changed

+11
-88
lines changed

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene84/BWCLucene84Codec.java

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,19 @@ public class BWCLucene84Codec extends BWCCodec {
3636
private final LiveDocsFormat liveDocsFormat = new Lucene50LiveDocsFormat();
3737
private final CompoundFormat compoundFormat = new Lucene50CompoundFormat();
3838
private final PostingsFormat defaultFormat;
39+
private final DocValuesFormat defaultDVFormat;
3940

4041
private final PostingsFormat postingsFormat = new PerFieldPostingsFormat() {
4142
@Override
4243
public PostingsFormat getPostingsFormatForField(String field) {
43-
return BWCLucene84Codec.this.getPostingsFormatForField(field);
44+
return defaultFormat;
4445
}
4546
};
4647

4748
private final DocValuesFormat docValuesFormat = new PerFieldDocValuesFormat() {
4849
@Override
4950
public DocValuesFormat getDocValuesFormatForField(String field) {
50-
return BWCLucene84Codec.this.getDocValuesFormatForField(field);
51+
return defaultDVFormat;
5152
}
5253
};
5354

@@ -64,6 +65,7 @@ public BWCLucene84Codec(String name) {
6465
super(name);
6566
this.storedFieldsFormat = new Lucene50StoredFieldsFormat(Lucene50StoredFieldsFormat.Mode.BEST_SPEED);
6667
this.defaultFormat = new Lucene84PostingsFormat();
68+
this.defaultDVFormat = new Lucene80DocValuesFormat();
6769
}
6870

6971
@Override
@@ -101,35 +103,8 @@ public PointsFormat pointsFormat() {
101103
return pointsFormat;
102104
}
103105

104-
/**
105-
* Returns the postings format that should be used for writing new segments of <code>field</code>.
106-
*
107-
* <p>The default implementation always returns "Lucene84".
108-
*
109-
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility:
110-
* future version of Lucene are only guaranteed to be able to read the default implementation.
111-
*/
112-
public PostingsFormat getPostingsFormatForField(String field) {
113-
return defaultFormat;
114-
}
115-
116-
/**
117-
* Returns the docvalues format that should be used for writing new segments of <code>field</code>
118-
* .
119-
*
120-
* <p>The default implementation always returns "Lucene80".
121-
*
122-
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility:
123-
* future version of Lucene are only guaranteed to be able to read the default implementation.
124-
*/
125-
public DocValuesFormat getDocValuesFormatForField(String field) {
126-
return defaultDVFormat;
127-
}
128-
129106
@Override
130107
public final DocValuesFormat docValuesFormat() {
131108
return docValuesFormat;
132109
}
133-
134-
private final DocValuesFormat defaultDVFormat = new Lucene80DocValuesFormat();
135110
}

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene86/BWCLucene86Codec.java

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,19 @@ public class BWCLucene86Codec extends BWCCodec {
3636
private final CompoundFormat compoundFormat = new Lucene50CompoundFormat();
3737
private final PointsFormat pointsFormat = new Lucene86MetadataOnlyPointsFormat();
3838
private final PostingsFormat defaultFormat;
39+
private final DocValuesFormat defaultDVFormat;
3940

4041
private final PostingsFormat postingsFormat = new PerFieldPostingsFormat() {
4142
@Override
4243
public PostingsFormat getPostingsFormatForField(String field) {
43-
return BWCLucene86Codec.this.getPostingsFormatForField(field);
44+
return defaultFormat;
4445
}
4546
};
4647

4748
private final DocValuesFormat docValuesFormat = new PerFieldDocValuesFormat() {
4849
@Override
4950
public DocValuesFormat getDocValuesFormatForField(String field) {
50-
return BWCLucene86Codec.this.getDocValuesFormatForField(field);
51+
return defaultDVFormat;
5152
}
5253
};
5354

@@ -64,6 +65,7 @@ public BWCLucene86Codec(String name) {
6465
super(name);
6566
this.storedFieldsFormat = new Lucene50StoredFieldsFormat(Lucene50StoredFieldsFormat.Mode.BEST_SPEED);
6667
this.defaultFormat = new Lucene84PostingsFormat();
68+
this.defaultDVFormat = new Lucene80DocValuesFormat();
6769
}
6870

6971
@Override
@@ -101,36 +103,8 @@ public PointsFormat pointsFormat() {
101103
return pointsFormat;
102104
}
103105

104-
/**
105-
* Returns the postings format that should be used for writing new segments of <code>field</code>.
106-
*
107-
* <p>The default implementation always returns "Lucene84".
108-
*
109-
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility:
110-
* future version of Lucene are only guaranteed to be able to read the default implementation.
111-
*/
112-
public PostingsFormat getPostingsFormatForField(String field) {
113-
return defaultFormat;
114-
}
115-
116-
/**
117-
* Returns the docvalues format that should be used for writing new segments of <code>field</code>
118-
* .
119-
*
120-
* <p>The default implementation always returns "Lucene80".
121-
*
122-
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility:
123-
* future version of Lucene are only guaranteed to be able to read the default implementation.
124-
*/
125-
public DocValuesFormat getDocValuesFormatForField(String field) {
126-
return defaultDVFormat;
127-
}
128-
129106
@Override
130107
public final DocValuesFormat docValuesFormat() {
131108
return docValuesFormat;
132109
}
133-
134-
private final DocValuesFormat defaultDVFormat = new Lucene80DocValuesFormat();
135-
136110
}

x-pack/plugin/old-lucene-versions/src/main/java/org/elasticsearch/xpack/lucene/bwc/codecs/lucene87/BWCLucene87Codec.java

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,19 @@ private enum Mode {
5757
private final CompoundFormat compoundFormat = new Lucene50CompoundFormat();
5858
private final PointsFormat pointsFormat = new Lucene86MetadataOnlyPointsFormat();
5959
private final PostingsFormat defaultFormat;
60+
private final DocValuesFormat defaultDVFormat;
6061

6162
private final PostingsFormat postingsFormat = new PerFieldPostingsFormat() {
6263
@Override
6364
public PostingsFormat getPostingsFormatForField(String field) {
64-
return BWCLucene87Codec.this.getPostingsFormatForField(field);
65+
return defaultFormat;
6566
}
6667
};
6768

6869
private final DocValuesFormat docValuesFormat = new PerFieldDocValuesFormat() {
6970
@Override
7071
public DocValuesFormat getDocValuesFormatForField(String field) {
71-
return BWCLucene87Codec.this.getDocValuesFormatForField(field);
72+
return defaultDVFormat;
7273
}
7374
};
7475

@@ -122,35 +123,8 @@ public PointsFormat pointsFormat() {
122123
return pointsFormat;
123124
}
124125

125-
/**
126-
* Returns the postings format that should be used for writing new segments of <code>field</code>.
127-
*
128-
* <p>The default implementation always returns "Lucene84".
129-
*
130-
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility:
131-
* future version of Lucene are only guaranteed to be able to read the default implementation.
132-
*/
133-
public PostingsFormat getPostingsFormatForField(String field) {
134-
return defaultFormat;
135-
}
136-
137-
/**
138-
* Returns the docvalues format that should be used for writing new segments of <code>field</code>
139-
* .
140-
*
141-
* <p>The default implementation always returns "Lucene80".
142-
*
143-
* <p><b>WARNING:</b> if you subclass, you are responsible for index backwards compatibility:
144-
* future version of Lucene are only guaranteed to be able to read the default implementation.
145-
*/
146-
public DocValuesFormat getDocValuesFormatForField(String field) {
147-
return defaultDVFormat;
148-
}
149-
150126
@Override
151127
public final DocValuesFormat docValuesFormat() {
152128
return docValuesFormat;
153129
}
154-
155-
private final DocValuesFormat defaultDVFormat;
156130
}

0 commit comments

Comments
 (0)