Beispiel #1
0
        public PreFlexRWFieldsWriter(SegmentWriteState state)
        {
            termsOut = new TermInfosWriter(state.Directory, state.SegmentInfo.Name, state.FieldInfos, state.TermIndexInterval);

            bool success = false;

            try
            {
                string freqFile = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "", Lucene3xPostingsFormat.FREQ_EXTENSION);
                freqOut      = state.Directory.CreateOutput(freqFile, state.Context);
                totalNumDocs = state.SegmentInfo.DocCount;
                success      = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.DisposeWhileHandlingException(termsOut);
                }
            }

            success = false;
            try
            {
                if (state.FieldInfos.HasProx)
                {
                    string proxFile = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "", Lucene3xPostingsFormat.PROX_EXTENSION);
                    proxOut = state.Directory.CreateOutput(proxFile, state.Context);
                }
                else
                {
                    proxOut = null;
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.DisposeWhileHandlingException(termsOut, freqOut);
                }
            }

            skipListWriter = new PreFlexRWSkipListWriter(termsOut.skipInterval, termsOut.maxSkipLevels, totalNumDocs, freqOut, proxOut);
            //System.out.println("\nw start seg=" + segment);
        }
        public PreFlexRWFieldsWriter(SegmentWriteState state)
        {
            TermsOut = new TermInfosWriter(state.Directory, state.SegmentInfo.Name, state.FieldInfos, state.TermIndexInterval);

            bool success = false;
            try
            {
                string freqFile = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "", Lucene3xPostingsFormat.FREQ_EXTENSION);
                FreqOut = state.Directory.CreateOutput(freqFile, state.Context);
                TotalNumDocs = state.SegmentInfo.DocCount;
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(TermsOut);
                }
            }

            success = false;
            try
            {
                if (state.FieldInfos.HasProx())
                {
                    string proxFile = IndexFileNames.SegmentFileName(state.SegmentInfo.Name, "", Lucene3xPostingsFormat.PROX_EXTENSION);
                    ProxOut = state.Directory.CreateOutput(proxFile, state.Context);
                }
                else
                {
                    ProxOut = null;
                }
                success = true;
            }
            finally
            {
                if (!success)
                {
                    IOUtils.CloseWhileHandlingException(TermsOut, FreqOut);
                }
            }

            SkipListWriter = new PreFlexRWSkipListWriter(TermsOut.SkipInterval, TermsOut.MaxSkipLevels, TotalNumDocs, FreqOut, ProxOut);
            //System.out.println("\nw start seg=" + segment);
        }