Lucene.Net.Search.CachingCollector.NoScoreCachingCollector.Collect C# (CSharp) Method

Collect() public method

public Collect ( int doc ) : void
doc int
return void
            public override void Collect(int doc)
            {
                if (CurDocs == null)
                {
                    // Cache was too large
                    Other.Collect(doc);
                    return;
                }

                // Allocate a bigger array or abort caching
                if (Upto == CurDocs.Length)
                {
                    @base += Upto;

                    // Compute next array length - don't allocate too big arrays
                    int nextLength = 8 * CurDocs.Length;
                    if (nextLength > MAX_ARRAY_SIZE)
                    {
                        nextLength = MAX_ARRAY_SIZE;
                    }

                    if (@base + nextLength > MaxDocsToCache)
                    {
                        // try to allocate a smaller array
                        nextLength = MaxDocsToCache - @base;
                        if (nextLength <= 0)
                        {
                            // Too many docs to collect -- clear cache
                            CurDocs = null;
                            CachedSegs.Clear();
                            CachedDocs.Clear();
                            Other.Collect(doc);
                            return;
                        }
                    }

                    CurDocs = new int[nextLength];
                    CachedDocs.Add(CurDocs);
                    Upto = 0;
                }

                CurDocs[Upto] = doc;
                Upto++;
                Other.Collect(doc);
            }
CachingCollector.NoScoreCachingCollector