Lucene.Net.Index.TestStressIndexing2.IndexSerial C# (CSharp) Method

IndexSerial() public static method

public static IndexSerial ( System docs, Lucene.Net.Store.Directory dir ) : void
docs System
dir Lucene.Net.Store.Directory
return void
		public static void  IndexSerial(System.Collections.IDictionary docs, Directory dir)
		{
			IndexWriter w = new IndexWriter(dir, new WhitespaceAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);
			
			// index all docs in a single thread
			System.Collections.IEnumerator iter = docs.Values.GetEnumerator();
			while (iter.MoveNext())
			{
				Document d = (Document) iter.Current;
                var fields = new List<IFieldable>();
				fields.AddRange(d.GetFields());
				// put fields in same order each time
                //{{Lucene.Net-2.9.1}} No, don't change the order of the fields
				//SupportClass.CollectionsHelper.Sort(fields, fieldNameComparator);
				
				Document d1 = new Document();
				d1.Boost = d.Boost;
				for (int i = 0; i < fields.Count; i++)
				{
					d1.Add((IFieldable) fields[i]);
				}
				w.AddDocument(d1);
				// System.out.println("indexing "+d1);
			}
			
			w.Close();
		}