Skip to content

Commit

Permalink
Remove perfield as it is inherited
Browse files Browse the repository at this point in the history
Signed-off-by: John Mazanec <[email protected]>
  • Loading branch information
jmazanec15 committed Mar 17, 2022
1 parent b3db12b commit 31f5be9
Showing 1 changed file with 1 addition and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import org.apache.lucene.codecs.Codec;
import org.apache.lucene.codecs.CompoundFormat;
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat;

/**
* Extends the Codec to support a new file format for KNN index
Expand All @@ -22,7 +21,6 @@
public final class KNN87Codec extends FilterCodec {

private final DocValuesFormat docValuesFormat;
private final DocValuesFormat perFieldDocValuesFormat;
private final CompoundFormat compoundFormat;

public static final String KNN_87 = "KNN87Codec";
Expand All @@ -44,23 +42,12 @@ public KNN87Codec(Codec delegate) {
// Note that DocValuesFormat can use old Codec's DocValuesFormat. For instance Lucene84 uses Lucene80
// DocValuesFormat. Refer to defaultDVFormat in LuceneXXCodec.java to find out which version it uses
this.docValuesFormat = new KNN80DocValuesFormat(delegate.docValuesFormat());
this.perFieldDocValuesFormat = new PerFieldDocValuesFormat() {
@Override
public DocValuesFormat getDocValuesFormatForField(String field) {
// If the delegate is an instanceof Lucene87, we can get a field specific doc values format
// delegate
if (delegate instanceof Lucene87Codec) {
return new KNN80DocValuesFormat(((Lucene87Codec) delegate).getDocValuesFormatForField(field));
}
return docValuesFormat;
}
};
this.compoundFormat = new KNN80CompoundFormat(delegate.compoundFormat());
}

@Override
public DocValuesFormat docValuesFormat() {
return this.perFieldDocValuesFormat;
return this.docValuesFormat;
}

@Override
Expand Down

0 comments on commit 31f5be9

Please sign in to comment.