-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding KNN codec that is based on Lucene92 codec (#444)
* Adding KNN codec that is based on Lucene92 codec Signed-off-by: Martin Gaievski <gaievski@amazon.com>
- Loading branch information
1 parent
fe9f293
commit 7499375
Showing
9 changed files
with
126 additions
and
94 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
src/main/java/org/opensearch/knn/index/codec/KNN920Codec/KNN920Codec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.opensearch.knn.index.codec.KNN920Codec; | ||
|
||
import lombok.Builder; | ||
import org.apache.lucene.codecs.Codec; | ||
import org.apache.lucene.codecs.CompoundFormat; | ||
import org.apache.lucene.codecs.DocValuesFormat; | ||
import org.apache.lucene.codecs.FilterCodec; | ||
import org.opensearch.knn.index.codec.KNNFormatFacade; | ||
import org.opensearch.knn.index.codec.KNNFormatFactory; | ||
|
||
import static org.opensearch.knn.index.codec.KNNCodecFactory.CodecDelegateFactory.createKNN92DefaultDelegate; | ||
|
||
/** | ||
* KNN codec that is based on Lucene92 codec | ||
*/ | ||
public final class KNN920Codec extends FilterCodec { | ||
|
||
private static final String KNN920 = "KNN920Codec"; | ||
private final KNNFormatFacade knnFormatFacade; | ||
|
||
/** | ||
* No arg constructor that uses Lucene91 as the delegate | ||
*/ | ||
public KNN920Codec() { | ||
this(createKNN92DefaultDelegate()); | ||
} | ||
|
||
/** | ||
* Constructor that takes a Codec delegate to delegate all methods this code does not implement to. | ||
* | ||
* @param delegate codec that will perform all operations this codec does not override | ||
*/ | ||
@Builder | ||
public KNN920Codec(Codec delegate) { | ||
super(KNN920, delegate); | ||
knnFormatFacade = KNNFormatFactory.createKNN920Format(delegate); | ||
} | ||
|
||
@Override | ||
public DocValuesFormat docValuesFormat() { | ||
return knnFormatFacade.docValuesFormat(); | ||
} | ||
|
||
@Override | ||
public CompoundFormat compoundFormat() { | ||
return knnFormatFacade.compoundFormat(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 0 additions & 49 deletions
49
src/main/java/org/opensearch/knn/index/codec/util/CodecBuilder.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/test/java/org/opensearch/knn/index/codec/KNN920Codec/KNN920CodecTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.knn.index.codec.KNN920Codec; | ||
|
||
import org.opensearch.knn.index.codec.KNNCodecTestCase; | ||
|
||
import java.io.IOException; | ||
import java.util.concurrent.ExecutionException; | ||
|
||
public class KNN920CodecTests extends KNNCodecTestCase { | ||
|
||
public void testMultiFieldsKnnIndex() throws Exception { | ||
testMultiFieldsKnnIndex(new KNN920Codec()); | ||
} | ||
|
||
public void testBuildFromModelTemplate() throws InterruptedException, ExecutionException, IOException { | ||
testBuildFromModelTemplate(new KNN920Codec()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters