forked from apache/lucene
-
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.
Signed-off-by: Bharathwaj G <[email protected]>
- Loading branch information
1 parent
c993b9a
commit d445522
Showing
55 changed files
with
1,485 additions
and
43 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
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
40 changes: 40 additions & 0 deletions
40
lucene/core/src/java/org/apache/lucene/codecs/DataCubesFormat.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,40 @@ | ||
package org.apache.lucene.codecs; | ||
|
||
import java.io.IOException; | ||
import org.apache.lucene.index.DataCubesConfig; | ||
import org.apache.lucene.index.DataCubeDocValuesConsumer; | ||
import org.apache.lucene.index.SegmentReadState; | ||
import org.apache.lucene.index.SegmentWriteState; | ||
import org.apache.lucene.util.NamedSPILoader; | ||
|
||
|
||
public abstract class DataCubesFormat implements NamedSPILoader.NamedSPI{ | ||
|
||
private final String name; | ||
protected DataCubesFormat(String name) { | ||
NamedSPILoader.checkServiceName(name); | ||
this.name = name; | ||
} | ||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
public abstract DataCubesProducer<?> fieldsProducer(SegmentReadState state) throws IOException; | ||
|
||
public abstract DataCubeDocValuesConsumer fieldsConsumer(SegmentWriteState state, DataCubesConfig compositeConfig) throws IOException; | ||
|
||
public static final DataCubesFormat EMPTY = new DataCubesFormat("EMPTY") { | ||
@Override | ||
public DataCubesProducer<?> fieldsProducer(SegmentReadState state) | ||
throws IOException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public DataCubeDocValuesConsumer fieldsConsumer(SegmentWriteState state, DataCubesConfig compositeConfig) | ||
throws IOException { | ||
throw new UnsupportedOperationException("Attempt to write EMPTY composite values"); | ||
} | ||
}; | ||
} |
18 changes: 18 additions & 0 deletions
18
lucene/core/src/java/org/apache/lucene/codecs/DataCubesProducer.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,18 @@ | ||
package org.apache.lucene.codecs; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
import org.apache.lucene.index.DataCubeValues; | ||
|
||
|
||
public abstract class DataCubesProducer<T> implements Closeable { | ||
|
||
protected DataCubesProducer() {} | ||
public abstract void checkIntegrity() throws IOException; | ||
public abstract DataCubeValues<?> getDataCubeValues(String field) throws IOException; | ||
|
||
public DataCubesProducer<T> getMergeInstance() { | ||
return this; | ||
} | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
lucene/core/src/java/org/apache/lucene/codecs/DataCubesWriter.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,32 @@ | ||
package org.apache.lucene.codecs; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
import org.apache.lucene.codecs.lucene90.Lucene90DocValuesFormat; | ||
import org.apache.lucene.index.FieldInfo; | ||
import org.apache.lucene.index.MergeState; | ||
import org.apache.lucene.index.SegmentWriteState; | ||
import org.apache.lucene.index.Sorter; | ||
import org.apache.lucene.util.Accountable; | ||
|
||
|
||
public abstract class DataCubesWriter<T> implements Accountable, Closeable { | ||
|
||
private final DocValuesConsumer docValuesWriter; | ||
|
||
public DataCubesWriter(SegmentWriteState state) | ||
throws IOException { | ||
docValuesWriter = new Lucene90DocValuesFormat().fieldsConsumer(state); | ||
} | ||
|
||
public abstract DataCubesWriter<?> addField(FieldInfo field) throws IOException; | ||
|
||
public void merge(MergeState mergeState) throws IOException { | ||
|
||
} | ||
public abstract void finish() throws IOException; | ||
|
||
public void flush(SegmentWriteState state, Sorter.DocMap sortMap) { | ||
|
||
} | ||
} |
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
55 changes: 55 additions & 0 deletions
55
lucene/core/src/java/org/apache/lucene/codecs/example/BufferedAggregatedDocValues.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,55 @@ | ||
package org.apache.lucene.codecs.example; | ||
|
||
import java.io.IOException; | ||
import org.apache.lucene.index.NumericDocValues; | ||
import org.apache.lucene.search.DocIdSetIterator; | ||
import org.apache.lucene.util.packed.PackedLongValues; | ||
|
||
|
||
public class BufferedAggregatedDocValues extends NumericDocValues { | ||
final PackedLongValues.Iterator iter; | ||
final DocIdSetIterator docsWithField; | ||
private long value; | ||
|
||
public BufferedAggregatedDocValues(PackedLongValues values, DocIdSetIterator docsWithFields) { | ||
this.iter = values.iterator(); | ||
this.docsWithField = docsWithFields; | ||
} | ||
|
||
@Override | ||
public int docID() { | ||
return docsWithField.docID(); | ||
} | ||
|
||
@Override | ||
public int nextDoc() throws IOException { | ||
|
||
|
||
int docID = docsWithField.nextDoc(); | ||
if (docID != NO_MORE_DOCS) { | ||
value = iter.next(); | ||
} | ||
return docID; | ||
} | ||
|
||
@Override | ||
public int advance(int target) { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public boolean advanceExact(int target) throws IOException { | ||
throw new UnsupportedOperationException(); | ||
} | ||
|
||
@Override | ||
public long cost() { | ||
return docsWithField.cost(); | ||
} | ||
|
||
@Override | ||
public long longValue() { | ||
return value; | ||
} | ||
} | ||
|
Oops, something went wrong.