@@ -40,23 +40,23 @@ import (
4040// All iterators work with pre-sorted data and return information
4141// in an order optimal for creating disk index structures.
4242type ActiveSealingSource struct {
43- params common.SealParams // Sealing parameters
44- info * common.Info // fraction Info
45- created time.Time // Creation time of the source
46- sortedLIDs []uint32 // Sorted LIDs (Local ID)
47- oldToNewLIDs []uint32 // Mapping from old LIDs to new ones (after sorting)
48- mids * UInt64s // MIDs
49- rids * UInt64s // RIDs
50- fields []string // Sorted field names
51- fieldsMaxTIDs []uint32 // Maximum TIDs for each field
52- tids []uint32 // Sorted TIDs (Token ID)
53- tokens [][]byte // Tokens (values) by TID
54- lids []* TokenLIDs // LID lists for each token
55- docPosOrig [ ]seq.DocPos // Original document positions
56- docPosSorted []seq.DocPos // Document positions after sorting
57- blocksOffsets []uint64 // Document block offsets
58- docsReader * storage.DocsReader // Document storage reader
59- lastErr error // Last error
43+ params common.SealParams // Sealing parameters
44+ info * common.Info // fraction Info
45+ created time.Time // Creation time of the source
46+ sortedLIDs []uint32 // Sorted LIDs (Local ID)
47+ oldToNewLIDs []uint32 // Mapping from old LIDs to new ones (after sorting)
48+ mids * UInt64s // MIDs
49+ rids * UInt64s // RIDs
50+ fields []string // Sorted field names
51+ fieldsMaxTIDs []uint32 // Maximum TIDs for each field
52+ tids []uint32 // Sorted TIDs (Token ID)
53+ tokens [][]byte // Tokens (values) by TID
54+ lids []* TokenLIDs // LID lists for each token
55+ docPosMap map [seq. ID ]seq.DocPos // Original document positions
56+ docPosSorted []seq.DocPos // Document positions after sorting
57+ blocksOffsets []uint64 // Document block offsets
58+ docsReader * storage.DocsReader // Document storage reader
59+ lastErr error // Last error
6060}
6161
6262// NewActiveSealingSource creates a new data source for sealing
@@ -84,7 +84,7 @@ func NewActiveSealingSource(active *Active, params common.SealParams) (*ActiveSe
8484 fieldsMaxTIDs : fieldsMaxTIDs ,
8585 tokens : active .TokenList .tidToVal ,
8686 lids : active .TokenList .tidToLIDs ,
87- docPosOrig : active .DocsPositions .lidToPos ,
87+ docPosMap : active .DocsPositions .idToPos ,
8888 blocksOffsets : active .DocBlocks .vals ,
8989 docsReader : & active .sortReader ,
9090 }
@@ -237,7 +237,7 @@ func (src *ActiveSealingSource) IDsBlocks(blockSize int) iter.Seq2[[]seq.ID, []s
237237
238238 // Use sorted or original positions
239239 if len (src .docPosSorted ) == 0 {
240- pos = append (pos , src .docPosOrig [ lid ])
240+ pos = append (pos , src .docPosMap [ id ])
241241 } else {
242242 pos = append (pos , src .docPosSorted [i + 1 ]) // +1 for system document
243243 }
0 commit comments