Exemple #1
0
        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());
            }
        }
        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?> GetNumericIterator(int maxDoc)
        {
            // .NET Port: using yield return instead of custom iterator type. Much less code.
            AbstractAppendingLongBuffer.Iterator iter = Pending.GetIterator();
            int size = (int)Pending.Size();
            int upto = 0;

            while (upto < maxDoc)
            {
                long?value;
                if (upto < size)
                {
                    var v = iter.Next();
                    if (DocsWithField == null || DocsWithField.Get(upto))
                    {
                        value = v;
                    }
                    else
                    {
                        value = null;
                    }
                }
                else
                {
                    value = DocsWithField != null ? (long?)null : MISSING;
                }
                upto++;
                // TODO: make reusable Number
                yield return(value);
            }
        }
Exemple #4
0
        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> GetNumericIterator(int maxDoc)
        {
            // .NET Port: using yield return instead of custom iterator type. Much less code.

            AbstractAppendingLongBuffer.Iterator iter = Pending.GetIterator();
            int size = (int)Pending.Size();
            int upto = 0;

            while (upto < maxDoc)
            {
                long value;
                if (upto < size)
                {
                    value = iter.Next();
                }
                else
                {
                    value = 0;
                }
                upto++;
                // TODO: make reusable Number
                yield return(value);
            }
        }
Exemple #6
0
        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);
            }
        }