forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes in merge, aggregators, added tests, addressed comments
Signed-off-by: Sarthak Aggarwal <[email protected]>
- Loading branch information
1 parent
3b2ad9b
commit cf53b70
Showing
21 changed files
with
509 additions
and
273 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
server/src/main/java/org/opensearch/index/codec/composite/DocValuesProvider.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,38 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.codec.composite; | ||
|
||
import org.apache.lucene.codecs.DocValuesProducer; | ||
import org.apache.lucene.index.SortedNumericDocValues; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* An interface that provides access to document values for a specific field. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public interface DocValuesProvider { | ||
|
||
/** | ||
* Returns the sorted numeric document values for the specified field. | ||
* | ||
* @param fieldName The name of the field for which to retrieve the sorted numeric document values. | ||
* @return The sorted numeric document values for the specified field. | ||
* @throws IOException If an error occurs while retrieving the sorted numeric document values. | ||
*/ | ||
SortedNumericDocValues getSortedNumeric(String fieldName) throws IOException; | ||
|
||
/** | ||
* Returns the DocValuesProducer instance. | ||
* | ||
* @return The DocValuesProducer instance. | ||
*/ | ||
DocValuesProducer getDocValuesProducer(); | ||
} |
46 changes: 46 additions & 0 deletions
46
...er/src/main/java/org/opensearch/index/codec/composite/LuceneDocValuesConsumerFactory.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,46 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.codec.composite; | ||
|
||
import org.apache.lucene.codecs.DocValuesConsumer; | ||
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesConsumerWrapper; | ||
import org.apache.lucene.index.SegmentWriteState; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.opensearch.index.codec.composite.composite99.Composite99Codec.COMPOSITE_INDEX_CODEC_NAME; | ||
|
||
/** | ||
* A factory class that provides a factory method for creating {@link DocValuesConsumer} instances | ||
* based on the specified composite codec. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class LuceneDocValuesConsumerFactory { | ||
|
||
public static DocValuesConsumer getDocValuesConsumerForCompositeCodec( | ||
String compositeCodec, | ||
SegmentWriteState state, | ||
String dataCodec, | ||
String dataExtension, | ||
String metaCodec, | ||
String metaExtension | ||
) throws IOException { | ||
|
||
switch (compositeCodec) { | ||
case COMPOSITE_INDEX_CODEC_NAME: | ||
return new Lucene90DocValuesConsumerWrapper(state, dataCodec, dataExtension, metaCodec, metaExtension) | ||
.getLucene90DocValuesConsumer(); | ||
default: | ||
throw new IllegalStateException("Invalid composite codec " + "[" + compositeCodec + "]"); | ||
} | ||
|
||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
...er/src/main/java/org/opensearch/index/codec/composite/LuceneDocValuesProducerFactory.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,44 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.codec.composite; | ||
|
||
import org.apache.lucene.codecs.DocValuesConsumer; | ||
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesProducerWrapper; | ||
import org.apache.lucene.index.SegmentReadState; | ||
import org.opensearch.index.codec.composite.composite99.Composite99Codec; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* A factory class that provides a factory method for creating {@link DocValuesConsumer} instances | ||
* based on the specified composite codec. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class LuceneDocValuesProducerFactory { | ||
|
||
public static DocValuesProvider getDocValuesProducerForCompositeCodec( | ||
String compositeCodec, | ||
SegmentReadState state, | ||
String dataCodec, | ||
String dataExtension, | ||
String metaCodec, | ||
String metaExtension | ||
) throws IOException { | ||
|
||
switch (compositeCodec) { | ||
case Composite99Codec.COMPOSITE_INDEX_CODEC_NAME: | ||
return new Lucene90DocValuesProducerWrapper(state, dataCodec, dataExtension, metaCodec, metaExtension); | ||
default: | ||
throw new IllegalStateException("Invalid composite codec " + "[" + compositeCodec + "]"); | ||
} | ||
|
||
} | ||
|
||
} |
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
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
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
Oops, something went wrong.