コード例 #1
0
        public /*internal*/ System.Collections.Generic.ICollection <string> CreateCompoundFile(System.String fileName)
        {
            System.Collections.Generic.ICollection <string> files = GetMergedFiles();
            CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, fileName, checkAbort);

            // Now merge all added files
            System.Collections.IEnumerator it = files.GetEnumerator();
            while (it.MoveNext())
            {
                cfsWriter.AddFile((System.String)it.Current);
            }

            // Perform the merge
            cfsWriter.Close();

            return(files);
        }
コード例 #2
0
ファイル: DocumentsWriter.cs プロジェクト: carrie901/mono
		/// <summary>Build compound file for the segment we just flushed </summary>
		internal void  CreateCompoundFile(System.String segment)
		{
			
			CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, segment + "." + IndexFileNames.COMPOUND_FILE_EXTENSION);
			System.Collections.IEnumerator it = flushState.flushedFiles.GetEnumerator();
			while (it.MoveNext())
			{
				cfsWriter.AddFile((System.String) ((System.Collections.DictionaryEntry) it.Current).Key);
			}
			
			// Perform the merge
			cfsWriter.Close();
		}
コード例 #3
0
ファイル: IndexWriter.cs プロジェクト: carrie901/mono
		/// <summary>Tells the docWriter to close its currently open shared
		/// doc stores (stored fields &amp; vectors files).
		/// Return value specifices whether new doc store files are compound or not.
		/// </summary>
		private bool FlushDocStores()
		{
			lock (this)
			{
                if (infoStream != null)
                {
                    Message("flushDocStores segment=" + docWriter.GetDocStoreSegment());
                }

				bool useCompoundDocStore = false;
                if (infoStream != null)
                {
                    Message("closeDocStores segment=" + docWriter.GetDocStoreSegment());
                }

				System.String docStoreSegment;
				
				bool success = false;
				try
				{
					docStoreSegment = docWriter.CloseDocStore();
					success = true;
				}
				finally
				{
					if (!success && infoStream != null)
					{
						Message("hit exception closing doc store segment");
					}
				}

                if (infoStream != null)
                {
                    Message("flushDocStores files=" + docWriter.ClosedFiles());
                }

				useCompoundDocStore = mergePolicy.UseCompoundDocStore(segmentInfos);
				
				if (useCompoundDocStore && docStoreSegment != null && docWriter.ClosedFiles().Count != 0)
				{
					// Now build compound doc store file
					
					if (infoStream != null)
					{
						Message("create compound file " + docStoreSegment + "." + IndexFileNames.COMPOUND_FILE_STORE_EXTENSION);
					}
					
					success = false;
					
					int numSegments = segmentInfos.Count;
					System.String compoundFileName = docStoreSegment + "." + IndexFileNames.COMPOUND_FILE_STORE_EXTENSION;
					
					try
					{
						CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, compoundFileName);
						System.Collections.IEnumerator it = docWriter.ClosedFiles().GetEnumerator();
						while (it.MoveNext())
						{
							cfsWriter.AddFile((System.String) it.Current);
						}
						
						// Perform the merge
						cfsWriter.Close();
						success = true;
					}
					finally
					{
						if (!success)
						{
							if (infoStream != null)
								Message("hit exception building compound file doc store for segment " + docStoreSegment);
							deleter.DeleteFile(compoundFileName);
						}
					}
					
					for (int i = 0; i < numSegments; i++)
					{
						SegmentInfo si = segmentInfos.Info(i);
						if (si.GetDocStoreOffset() != - 1 && si.GetDocStoreSegment().Equals(docStoreSegment))
							si.SetDocStoreIsCompoundFile(true);
					}
					
					Checkpoint();
					
					// In case the files we just merged into a CFS were
					// not previously checkpointed:
					deleter.DeleteNewFiles(docWriter.ClosedFiles());
				}
				
				return useCompoundDocStore;
			}
		}
コード例 #4
0
ファイル: SegmentMerger.cs プロジェクト: carrie901/mono
        public /*internal*/ System.Collections.Generic.ICollection<string> CreateCompoundFile(System.String fileName)
        {
            System.Collections.Generic.ICollection<string> files = GetMergedFiles();
            CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, fileName, checkAbort);

			// Now merge all added files
			System.Collections.IEnumerator it = files.GetEnumerator();
			while (it.MoveNext())
			{
				cfsWriter.AddFile((System.String) it.Current);
			}
			
			// Perform the merge
			cfsWriter.Close();

            return files;
		}