Esempio n. 1
0
        public override BlockTermState NewTermState()
        {
            var state = new PulsingTermState {
                wrappedState = _wrappedPostingsWriter.NewTermState()
            };

            return(state);
        }
Esempio n. 2
0
            public override void FinishTerm(BytesRef text, TermStats stats)
            {
                if (Debugging.AssertsEnabled)
                {
                    Debugging.Assert(stats.DocFreq > 0);
                }
                //System.out.println("BTW: finishTerm term=" + fieldInfo.name + ":" + text.utf8ToString() + " " + text + " seg=" + segment + " df=" + stats.docFreq);

                bool isIndexTerm = fieldIndexWriter.CheckIndexTerm(text, stats);

                if (isIndexTerm)
                {
                    if (pendingCount > 0)
                    {
                        // Instead of writing each term, live, we gather terms
                        // in RAM in a pending buffer, and then write the
                        // entire block in between index terms:
                        FlushBlock();
                    }
                    fieldIndexWriter.Add(text, stats, outerInstance.m_output.Position); // LUCENENET specific: Renamed from getFilePointer() to match FileStream
                    //System.out.println("  index term!");
                }

                if (pendingTerms.Length == pendingCount)
                {
                    TermEntry[] newArray = new TermEntry[ArrayUtil.Oversize(pendingCount + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
                    System.Array.Copy(pendingTerms, 0, newArray, 0, pendingCount);
                    for (int i = pendingCount; i < newArray.Length; i++)
                    {
                        newArray[i] = new TermEntry();
                    }
                    pendingTerms = newArray;
                }
                TermEntry te = pendingTerms[pendingCount];

                te.Term.CopyBytes(text);
                te.State               = postingsWriter.NewTermState();
                te.State.DocFreq       = stats.DocFreq;
                te.State.TotalTermFreq = stats.TotalTermFreq;
                postingsWriter.FinishTerm(te.State);

                pendingCount++;
                numTerms++;
            }
Esempio n. 3
0
            public override void FinishTerm(BytesRef text, TermStats stats)
            {
                Debug.Assert(stats.DocFreq > 0);

                var isIndexTerm = _fieldIndexWriter.CheckIndexTerm(text, stats);

                if (isIndexTerm)
                {
                    if (_pendingCount > 0)
                    {
                        // Instead of writing each term, live, we gather terms
                        // in RAM in a pending buffer, and then write the
                        // entire block in between index terms:
                        FlushBlock();
                    }
                    _fieldIndexWriter.Add(text, stats, _btw._output.FilePointer);
                }

                if (_pendingTerms.Length == _pendingCount)
                {
                    var newArray =
                        new TermEntry[ArrayUtil.Oversize(_pendingCount + 1, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
                    Array.Copy(_pendingTerms, 0, newArray, 0, _pendingCount);
                    for (var i = _pendingCount; i < newArray.Length; i++)
                    {
                        newArray[i] = new TermEntry();
                    }
                    _pendingTerms = newArray;
                }
                var te = _pendingTerms[_pendingCount];

                te.Term.CopyBytes(text);
                te.State               = _postingsWriter.NewTermState();
                te.State.DocFreq       = stats.DocFreq;
                te.State.TotalTermFreq = stats.TotalTermFreq;
                _postingsWriter.FinishTerm(te.State);

                _pendingCount++;
                _numTerms++;
            }