forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* star tree file formats Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com> * refactored meta, test fixes Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com> * refactored packages, minor fixes Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com> --------- Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com> Co-authored-by: Sarthak Aggarwal <sarthagg@amazon.com>
- Loading branch information
1 parent
59302a3
commit 9db1fa9
Showing
46 changed files
with
2,998 additions
and
286 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
server/src/main/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesConsumerWrapper.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,68 @@ | ||
/* | ||
* 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.apache.lucene.codecs.lucene90; | ||
|
||
import org.apache.lucene.codecs.DocValuesConsumer; | ||
import org.apache.lucene.codecs.DocValuesProducer; | ||
import org.apache.lucene.index.FieldInfo; | ||
import org.apache.lucene.index.SegmentWriteState; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* This class is an abstraction of the {@link DocValuesConsumer} for the Star Tree index structure. | ||
* It is responsible to consume various types of document values (numeric, binary, sorted, sorted numeric, | ||
* and sorted set) for fields in the Star Tree index. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class Lucene90DocValuesConsumerWrapper extends DocValuesConsumer { | ||
|
||
Lucene90DocValuesConsumer lucene90DocValuesConsumer; | ||
|
||
public Lucene90DocValuesConsumerWrapper( | ||
SegmentWriteState state, | ||
String dataCodec, | ||
String dataExtension, | ||
String metaCodec, | ||
String metaExtension | ||
) throws IOException { | ||
lucene90DocValuesConsumer = new Lucene90DocValuesConsumer(state, dataCodec, dataExtension, metaCodec, metaExtension); | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
lucene90DocValuesConsumer.close(); | ||
} | ||
|
||
@Override | ||
public void addNumericField(FieldInfo fieldInfo, DocValuesProducer docValuesProducer) throws IOException { | ||
lucene90DocValuesConsumer.addNumericField(fieldInfo, docValuesProducer); | ||
} | ||
|
||
@Override | ||
public void addBinaryField(FieldInfo fieldInfo, DocValuesProducer docValuesProducer) throws IOException { | ||
lucene90DocValuesConsumer.addNumericField(fieldInfo, docValuesProducer); | ||
} | ||
|
||
@Override | ||
public void addSortedField(FieldInfo fieldInfo, DocValuesProducer docValuesProducer) throws IOException { | ||
lucene90DocValuesConsumer.addSortedField(fieldInfo, docValuesProducer); | ||
} | ||
|
||
@Override | ||
public void addSortedNumericField(FieldInfo fieldInfo, DocValuesProducer docValuesProducer) throws IOException { | ||
lucene90DocValuesConsumer.addSortedNumericField(fieldInfo, docValuesProducer); | ||
} | ||
|
||
@Override | ||
public void addSortedSetField(FieldInfo fieldInfo, DocValuesProducer docValuesProducer) throws IOException { | ||
lucene90DocValuesConsumer.addSortedSetField(fieldInfo, docValuesProducer); | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
server/src/main/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducerWrapper.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,85 @@ | ||
/* | ||
* 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.apache.lucene.codecs.lucene90; | ||
|
||
import org.apache.lucene.codecs.DocValuesProducer; | ||
import org.apache.lucene.index.BinaryDocValues; | ||
import org.apache.lucene.index.FieldInfo; | ||
import org.apache.lucene.index.NumericDocValues; | ||
import org.apache.lucene.index.SegmentReadState; | ||
import org.apache.lucene.index.SortedDocValues; | ||
import org.apache.lucene.index.SortedNumericDocValues; | ||
import org.apache.lucene.index.SortedSetDocValues; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* This class is a custom abstraction of the {@link DocValuesProducer} for the Star Tree index structure. | ||
* It is responsible for providing access to various types of document values (numeric, binary, sorted, sorted numeric, | ||
* and sorted set) for fields in the Star Tree index. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class Lucene90DocValuesProducerWrapper extends DocValuesProducer { | ||
|
||
Lucene90DocValuesProducer lucene90DocValuesProducer; | ||
SegmentReadState state; | ||
|
||
public Lucene90DocValuesProducerWrapper( | ||
SegmentReadState state, | ||
String dataCodec, | ||
String dataExtension, | ||
String metaCodec, | ||
String metaExtension | ||
) throws IOException { | ||
lucene90DocValuesProducer = new Lucene90DocValuesProducer(state, dataCodec, dataExtension, metaCodec, metaExtension); | ||
this.state = state; | ||
} | ||
|
||
@Override | ||
public NumericDocValues getNumeric(FieldInfo field) throws IOException { | ||
return this.lucene90DocValuesProducer.getNumeric(field); | ||
} | ||
|
||
@Override | ||
public BinaryDocValues getBinary(FieldInfo field) throws IOException { | ||
return this.lucene90DocValuesProducer.getBinary(field); | ||
} | ||
|
||
@Override | ||
public SortedDocValues getSorted(FieldInfo field) throws IOException { | ||
return this.lucene90DocValuesProducer.getSorted(field); | ||
} | ||
|
||
@Override | ||
public SortedNumericDocValues getSortedNumeric(FieldInfo field) throws IOException { | ||
return this.lucene90DocValuesProducer.getSortedNumeric(field); | ||
} | ||
|
||
@Override | ||
public SortedSetDocValues getSortedSet(FieldInfo field) throws IOException { | ||
return this.lucene90DocValuesProducer.getSortedSet(field); | ||
} | ||
|
||
@Override | ||
public void checkIntegrity() throws IOException { | ||
this.lucene90DocValuesProducer.checkIntegrity(); | ||
} | ||
|
||
// returns the doc id set iterator based on field name | ||
public SortedNumericDocValues getSortedNumeric(String fieldName) throws IOException { | ||
return this.lucene90DocValuesProducer.getSortedNumeric(state.fieldInfos.fieldInfo(fieldName)); | ||
} | ||
|
||
@Override | ||
public void close() throws IOException { | ||
this.lucene90DocValuesProducer.close(); | ||
} | ||
|
||
} |
53 changes: 53 additions & 0 deletions
53
server/src/main/java/org/apache/lucene/index/SortedNumericDocValuesWriterWrapper.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,53 @@ | ||
/* | ||
* 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.apache.lucene.index; | ||
|
||
import org.apache.lucene.util.Counter; | ||
|
||
/** | ||
* A wrapper class for writing sorted numeric doc values. | ||
* <p> | ||
* This class provides a convenient way to add sorted numeric doc values to a field | ||
* and retrieve the corresponding {@link SortedNumericDocValues} instance. | ||
* | ||
* @opensearch.experimental | ||
*/ | ||
public class SortedNumericDocValuesWriterWrapper { | ||
|
||
private final SortedNumericDocValuesWriter sortedNumericDocValuesWriter; | ||
|
||
/** | ||
* Sole constructor. Constructs a new {@link SortedNumericDocValuesWriterWrapper} instance. | ||
* | ||
* @param fieldInfo the field information for the field being written | ||
* @param counter a counter for tracking memory usage | ||
*/ | ||
public SortedNumericDocValuesWriterWrapper(FieldInfo fieldInfo, Counter counter) { | ||
sortedNumericDocValuesWriter = new SortedNumericDocValuesWriter(fieldInfo, counter); | ||
} | ||
|
||
/** | ||
* Adds a value to the sorted numeric doc values for the specified document. | ||
* | ||
* @param docID the document ID | ||
* @param value the value to add | ||
*/ | ||
public void addValue(int docID, long value) { | ||
sortedNumericDocValuesWriter.addValue(docID, value); | ||
} | ||
|
||
/** | ||
* Returns the {@link SortedNumericDocValues} instance containing the sorted numeric doc values | ||
* | ||
* @return the {@link SortedNumericDocValues} instance | ||
*/ | ||
public SortedNumericDocValues getDocValues() { | ||
return sortedNumericDocValuesWriter.getDocValues(); | ||
} | ||
} |
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.