Exemplo n.º 1
0
        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());
            }
        }
Exemplo n.º 2
0
        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());
            }
        }
Exemplo n.º 3
0
        private IEnumerable <long?> GetNumericIterator(int maxDoc)
        {
            // LUCENENET specific: using yield return instead of custom iterator type. Much less code.
            AbstractAppendingInt64Buffer.Iterator iter = pending.GetIterator();
            int size = (int)pending.Count;
            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);
            }
        }
Exemplo n.º 4
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]);
            }
        }
Exemplo n.º 5
0
        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]);
            }
        }
Exemplo n.º 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);
            }
        }