private IEnumerable <long?> GetOrdCountEnumberable(int maxCountPerDoc, int[] ordMap)
        {
            int currentUpTo = 0, currentLength = 0;

            AppendingPackedInt64Buffer.Iterator      iter   = pending.GetIterator();
            AppendingDeltaPackedInt64Buffer.Iterator counts = pendingCounts.GetIterator();
            int[] currentDoc = new int[maxCountPerDoc];

            for (long i = 0; i < pending.Count; ++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);
            }
        }
Beispiel #2
0
        private IEnumerable <long?> GetOrdsEnumberable(int maxDoc, int[] ordMap)
        {
            AppendingDeltaPackedInt64Buffer.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)
        {
            AppendingDeltaPackedInt64Buffer.Iterator iter = pendingCounts.GetIterator();

            Debug.Assert(maxDoc == pendingCounts.Count, "MaxDoc: " + maxDoc + ", pending.Count: " + pending.Count);

            for (int i = 0; i < maxDoc; ++i)
            {
                yield return((int)iter.Next());
            }
        }
        private IEnumerable <long?> GetOrdsEnumberable(int maxDoc)
        {
            AppendingDeltaPackedInt64Buffer.Iterator iter = pendingCounts.GetIterator();

            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(pendingCounts.Count == maxDoc, () => "MaxDoc: " + maxDoc + ", pending.Count: " + pending.Count);
            }

            for (int i = 0; i < maxDoc; ++i)
            {
                yield return(iter.Next());
            }
        }
        private IEnumerable <long?> GetOrdsEnumberable(int maxDoc, int[] ordMap)
        {
            AppendingDeltaPackedInt64Buffer.Iterator iter = pending.GetIterator();
            if (Debugging.AssertsEnabled)
            {
                Debugging.Assert(pending.Count == maxDoc);
            }

            for (int i = 0; i < maxDoc; ++i)
            {
                int ord = (int)iter.Next();
                yield return(ord == -1 ? ord : ordMap[ord]);
            }
        }
Beispiel #6
0
        private IEnumerable <BytesRef> GetBytesIterator(int maxDocParam)
        {
            // Use yield return instead of ucsom IEnumerable
            var value = new BytesRef();

            AppendingDeltaPackedInt64Buffer.Iterator lengthsIterator = lengths.GetIterator();
            int       size          = (int)lengths.Count;
            DataInput bytesIterator = bytes.GetDataInput();
            int       maxDoc        = maxDocParam;
            int       upto          = 0;

            while (upto < maxDoc)
            {
                BytesRef v = null;
                if (upto < size)
                {
                    int length = (int)lengthsIterator.Next();
                    value.Grow(length);
                    value.Length = length;
                    try
                    {
                        bytesIterator.ReadBytes(value.Bytes, value.Offset, value.Length);
                    }
                    catch (Exception ioe) when(ioe.IsIOException())
                    {
                        // Should never happen!
                        throw RuntimeException.Create(ioe);
                    }

                    if (docsWithField.Get(upto))
                    {
                        v = value;
                    }
                }

                upto++;
                yield return(v);
            }
        }