示例#1
0
        // private final String segment;

        public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter,
                                SegmentWriteState state, PostingsWriterBase postingsWriter)
        {
            string termsFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, TERMS_EXTENSION);

            this.termsIndexWriter = termsIndexWriter;
            m_output = state.Directory.CreateOutput(termsFileName, state.Context);
            bool success = false;

            try
            {
                //fieldInfos = state.FieldInfos; // LUCENENET: Not used
                WriteHeader(m_output);
                currentField        = null;
                this.postingsWriter = postingsWriter;
                // segment = state.segmentName;

                //System.out.println("BTW.init seg=" + state.segmentName);

                postingsWriter.Init(m_output); // have consumer write its format/header
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.DisposeWhileHandlingException(m_output);
                }
            }
        }
示例#2
0
        public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter,
            SegmentWriteState state, PostingsWriterBase postingsWriter)
        {
            var termsFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix,
                TERMS_EXTENSION);
            _termsIndexWriter = termsIndexWriter;
            _output = state.Directory.CreateOutput(termsFileName, state.Context);
            var success = false;

            try
            {
                FieldInfos = state.FieldInfos;
                WriteHeader(_output);
                CurrentField = null;
                PostingsWriter = postingsWriter;

                postingsWriter.Init(_output); // have consumer write its format/header
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(_output);
                }
            }
        }
示例#3
0
        public BlockTermsWriter(TermsIndexWriterBase termsIndexWriter,
                                SegmentWriteState state, PostingsWriterBase postingsWriter)
        {
            var termsFileName = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix,
                                                               TERMS_EXTENSION);

            _termsIndexWriter = termsIndexWriter;
            _output           = state.Directory.CreateOutput(termsFileName, state.Context);
            var success = false;

            try
            {
                FieldInfos = state.FieldInfos;
                WriteHeader(_output);
                CurrentField   = null;
                PostingsWriter = postingsWriter;

                postingsWriter.Init(_output); // have consumer write its format/header
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(_output);
                }
            }
        }
示例#4
0
            public TermsWriter(
                TermsIndexWriterBase.FieldWriter fieldIndexWriter,
                FieldInfo fieldInfo,
                PostingsWriterBase postingsWriter, BlockTermsWriter btw)
            {
                _fieldInfo = fieldInfo;
                _fieldIndexWriter = fieldIndexWriter;
                _btw = btw;

                _pendingTerms = new TermEntry[32];
                for (int i = 0; i < _pendingTerms.Length; i++)
                {
                    _pendingTerms[i] = new TermEntry();
                }
                _termsStartPointer = _btw._output.FilePointer;
                _postingsWriter = postingsWriter;
                _longsSize = postingsWriter.SetField(fieldInfo);
            }