protected internal AllTermDocs(SegmentReader parent) : base(parent.MaxDoc()) { lock (parent) { this.deletedDocs = parent.deletedDocs; } }
protected internal AllTermDocs(SegmentReader parent) : base(parent.MaxDoc()) { lock (parent) { this.deletedDocs = parent.deletedDocs; } }
public /*protected internal*/ SegmentTermDocs(SegmentReader parent) { this.parent = parent; this.freqStream = (IndexInput) parent.core.freqStream.Clone(); lock (parent) { this.deletedDocs = parent.deletedDocs; } this.skipInterval = parent.core.GetTermsReader().GetSkipInterval(); this.maxSkipLevels = parent.core.GetTermsReader().GetMaxSkipLevels(); }
public /*protected internal*/ SegmentTermDocs(SegmentReader parent) { this.parent = parent; this.freqStream = (IndexInput)parent.core.freqStream.Clone(); lock (parent) { this.deletedDocs = parent.deletedDocs; } this.skipInterval = parent.core.GetTermsReader().GetSkipInterval(); this.maxSkipLevels = parent.core.GetTermsReader().GetMaxSkipLevels(); }
public int GetDelCount() { if (delCount == - 1) { if (HasDeletions()) { System.String delFileName = GetDelFileName(); delCount = new BitVector(dir, delFileName).Count(); } else delCount = 0; } System.Diagnostics.Debug.Assert(delCount <= docCount); return delCount; }
/// <summary> Clones the deleteDocs BitVector. May be overridden by subclasses. New and experimental.</summary> /// <param name="bv">BitVector to clone /// </param> /// <returns> New BitVector /// </returns> protected internal virtual BitVector CloneDeletedDocs(BitVector bv) { return (BitVector) bv.Clone(); }
private void LoadDeletedDocs() { // NOTE: the bitvector is stored using the regular directory, not cfs if (HasDeletions(si)) { deletedDocs = new BitVector(Directory(), si.GetDelFileName()); deletedDocsRef = new Ref(); System.Diagnostics.Debug.Assert(CheckDeletedCounts()); } else System.Diagnostics.Debug.Assert(si.GetDelCount() == 0); }
protected internal override void DoUndeleteAll() { deletedDocsDirty = false; if (deletedDocs != null) { System.Diagnostics.Debug.Assert(deletedDocsRef != null); deletedDocsRef.DecRef(); deletedDocs = null; deletedDocsRef = null; pendingDeleteCount = 0; si.ClearDelGen(); si.SetDelCount(0); } else { System.Diagnostics.Debug.Assert(deletedDocsRef == null); System.Diagnostics.Debug.Assert(pendingDeleteCount == 0); } }
protected internal override void DoDelete(int docNum) { if (deletedDocs == null) { deletedDocs = new BitVector(MaxDoc()); deletedDocsRef = new Ref(); } // there is more than 1 SegmentReader with a reference to this // deletedDocs BitVector so decRef the current deletedDocsRef, // clone the BitVector, create a new deletedDocsRef if (deletedDocsRef.RefCount() > 1) { Ref oldRef = deletedDocsRef; deletedDocs = CloneDeletedDocs(deletedDocs); deletedDocsRef = new Ref(); oldRef.DecRef(); } deletedDocsDirty = true; if (!deletedDocs.GetAndSet(docNum)) pendingDeleteCount++; }
protected internal override void DoClose() { termVectorsLocal.Close(); fieldsReaderLocal.Close(); if (deletedDocs != null) { deletedDocsRef.DecRef(); // null so if an app hangs on to us we still free most ram deletedDocs = null; } System.Collections.IEnumerator it = norms.Values.GetEnumerator(); while (it.MoveNext()) { ((Norm) it.Current).DecRef(); } if (core != null) { core.DecRef(); } }