コード例 #1
0
        protected override void AddTerm(string term, PostingListAddress address)
        {
            dictionaryWriter.AddTerm(term, address, existingList => occurrenceWriter.UpdateNextList(existingList, address));

            ++updates;
            if (updates > AutoCommitThreshold)
            {
                dictionaryUpdate.Commit();
                dictionaryUpdate = dictionaryWriter.BeginUpdate();
                updates          = 0;
            }
        }
コード例 #2
0
        protected override void AddDocVector(ulong id, ulong fieldId, IEnumerable <TextPosition> positions)
        {
            var listStart = positionsWriter.StartList();

            foreach (var pos in positions)
            {
                positionsWriter.AddValue((ulong)pos.Offset + 1);
                positionsWriter.AddValue((ulong)pos.Offset + 1 + (ulong)pos.Length);
            }
            var listEnd = positionsWriter.EndList();

            var key = PersistentIndex.GetKeyForPositions('P', id, fieldId);

            posIndexWriter.AddTerm(key,
                                   new PostingListAddress(listStart),
                                   _ => throw new Exception("Not expected"));
            ++posUpdates;
            if (posUpdates > AutoCommitThreshold)
            {
                posIndexUpdate.Commit();
                posIndexUpdate = posIndexWriter.BeginUpdate();
                posUpdates     = 0;
            }
        }
コード例 #3
0
 protected override void DoStop()
 {
     dictionaryUpdate?.Commit();
     DisposeObjects();
 }