private IEnumerable <BytesRef> GetBytesIterator(int maxDocParam) { // Use yield return instead of ucsom IEnumerable BytesRef value = new BytesRef(); AppendingDeltaPackedLongBuffer.Iterator lengthsIterator = (AppendingDeltaPackedLongBuffer.Iterator)Lengths.GetIterator(); int size = (int)Lengths.Size(); DataInput bytesIterator = Bytes.DataInput; int maxDoc = maxDocParam; int upto = 0; long byteOffset = 0L; while (upto < maxDoc) { if (upto < size) { int length = (int)lengthsIterator.Next(); value.Grow(length); value.Length = length; //LUCENE TODO: This modification is slightly fishy, 4x port uses ByteBlockPool bytesIterator.ReadBytes(/*byteOffset,*/ value.Bytes, value.Offset, value.Length); byteOffset += length; } else { // This is to handle last N documents not having // this DV field in the end of the segment: value.Length = 0; } upto++; yield return(value); } }
private IEnumerable <BytesRef> GetBytesIterator(int maxDocParam) { // Use yield return instead of ucsom IEnumerable AppendingDeltaPackedLongBuffer.Iterator lengthsIterator = Lengths.GetIterator(); int size = (int)Lengths.Size(); DataInput bytesIterator = Bytes.DataInput; int maxDoc = maxDocParam; int upto = 0; while (upto < maxDoc) { BytesRef v = null; if (upto < size) { int length = (int)lengthsIterator.Next(); var value = new BytesRef(); value.Grow(length); value.Length = length; bytesIterator.ReadBytes(value.Bytes, value.Offset, value.Length); if (DocsWithField.Get(upto)) { v = value; } } upto++; yield return(v); } }
private IEnumerable <long?> GetOrdCountEnumberable(int maxCountPerDoc, int[] ordMap) { int currentUpTo = 0, currentLength = 0; AppendingPackedLongBuffer.Iterator iter = Pending.GetIterator(); AppendingDeltaPackedLongBuffer.Iterator counts = PendingCounts.GetIterator(); int[] currentDoc = new int[maxCountPerDoc]; for (long i = 0; i < Pending.Size(); ++i) { while (currentUpTo == currentLength) { // refill next doc, and sort remapped ords within the doc. currentUpTo = 0; currentLength = (int)counts.Next(); for (int j = 0; j < currentLength; j++) { currentDoc[j] = ordMap[(int)iter.Next()]; } Array.Sort(currentDoc, 0, currentLength); } int ord = currentDoc[currentUpTo]; currentUpTo++; yield return(ord); } }
private IEnumerable <long?> GetOrdsEnumberable(int maxDoc, int[] ordMap) { AppendingDeltaPackedLongBuffer.Iterator iter = Pending.GetIterator(); for (int i = 0; i < maxDoc; ++i) { int ord = (int)iter.Next(); yield return(ord == -1 ? ord : ordMap[ord]); } }
private IEnumerable <long?> GetOrdsEnumberable(int maxDoc) { AppendingDeltaPackedLongBuffer.Iterator iter = PendingCounts.GetIterator(); Debug.Assert(maxDoc == PendingCounts.Size(), "MaxDoc: " + maxDoc + ", pending.Size(): " + Pending.Size()); for (int i = 0; i < maxDoc; ++i) { yield return((int)iter.Next()); } }