Search in sources :

Example 66 with SortedDocValues

use of org.apache.lucene.index.SortedDocValues in project stargate-core by tuplejump.

the class IndexEntryCollector method getIndexEntry.

IndexEntry getIndexEntry(int slot, int doc, float score) throws IOException {
    String pkName = LuceneUtils.primaryKeyName(pkNames, doc);
    ByteBuffer primaryKey = LuceneUtils.byteBufferDocValue(primaryKeys, doc);
    ByteBuffer rowKey = LuceneUtils.byteBufferDocValue(rowKeys, doc);
    Map<String, Number> numericDocValues = new HashMap<>();
    Map<String, String> binaryDocValues = new HashMap<>();
    for (Map.Entry<String, NumericDocValues> entry : numericDocValuesMap.entrySet()) {
        Type type = AggregateFunction.getLuceneType(options, entry.getKey());
        Number number = LuceneUtils.numericDocValue(entry.getValue(), doc, type);
        numericDocValues.put(entry.getKey(), number);
    }
    for (Map.Entry<String, SortedDocValues> entry : stringDocValues.entrySet()) {
        binaryDocValues.put(entry.getKey(), LuceneUtils.stringDocValue(entry.getValue(), doc));
    }
    return new IndexEntry(rowKey, pkName, primaryKey, slot, docBase + doc, score, numericDocValues, binaryDocValues);
}
Also used : NumericDocValues(org.apache.lucene.index.NumericDocValues) ByteBuffer(java.nio.ByteBuffer) SortedDocValues(org.apache.lucene.index.SortedDocValues) FieldType(org.apache.lucene.document.FieldType)

Aggregations

SortedDocValues (org.apache.lucene.index.SortedDocValues)66 BytesRef (org.apache.lucene.util.BytesRef)32 LeafReaderContext (org.apache.lucene.index.LeafReaderContext)27 SortedSetDocValues (org.apache.lucene.index.SortedSetDocValues)23 LeafReader (org.apache.lucene.index.LeafReader)22 Document (org.apache.lucene.document.Document)21 NumericDocValues (org.apache.lucene.index.NumericDocValues)15 Directory (org.apache.lucene.store.Directory)15 RandomIndexWriter (org.apache.lucene.index.RandomIndexWriter)14 SortedDocValuesField (org.apache.lucene.document.SortedDocValuesField)13 IOException (java.io.IOException)12 BinaryDocValues (org.apache.lucene.index.BinaryDocValues)12 MockAnalyzer (org.apache.lucene.analysis.MockAnalyzer)10 MultiDocValues (org.apache.lucene.index.MultiDocValues)10 ArrayList (java.util.ArrayList)9 IndexReader (org.apache.lucene.index.IndexReader)9 OrdinalMap (org.apache.lucene.index.MultiDocValues.OrdinalMap)9 DoublePoint (org.apache.lucene.document.DoublePoint)8 FloatPoint (org.apache.lucene.document.FloatPoint)8 IntPoint (org.apache.lucene.document.IntPoint)8