lucene-lucene-net-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject [Lucene.Net] svn commit: r1098382 - in /incubator/lucene.net/branches/Lucene.Net_2_9_4g: src/core/Index/ test/core/Index/
Date Sun, 01 May 2011 18:23:06 GMT
Author: digy
Date: Sun May  1 18:23:05 2011
New Revision: 1098382

URL: http://svn.apache.org/viewvc?rev=1098382&view=rev
Log:
[LUCENENET-412]

Modified:
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldProcessor.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocumentsWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsDocsWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsFieldsWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsPositionsWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/MultiReader.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/NormsWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/PositionBasedTermVectorMapper.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentWriteState.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/StoredFieldsWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs
    incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestPositionBasedTermVectorMapper.cs

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldProcessor.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldProcessor.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldProcessor.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocFieldProcessor.cs Sun
May  1 18:23:05 2011
@@ -68,7 +68,7 @@ namespace Lucene.Net.Index
 			// FieldInfo.storePayload.
 			System.String fileName = state.SegmentFileName(IndexFileNames.FIELD_INFOS_EXTENSION);
 			fieldInfos.Write(state.directory, fileName);
-			SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, fileName);
+            state.flushedFiles.Add(fileName);
 		}
 		
 		public override void  Abort()

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocumentsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocumentsWriter.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocumentsWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/DocumentsWriter.cs Sun
May  1 18:23:05 2011
@@ -832,7 +832,7 @@ namespace Lucene.Net.Index
 			}
 		}
 
-        internal System.Collections.ICollection GetFlushedFiles()
+        internal IList<string> GetFlushedFiles()
         {
             return flushState.flushedFiles;
         }
@@ -842,10 +842,9 @@ namespace Lucene.Net.Index
 		{
 			
 			CompoundFileWriter cfsWriter = new CompoundFileWriter(directory, segment + "." + IndexFileNames.COMPOUND_FILE_EXTENSION);
-			System.Collections.IEnumerator it = flushState.flushedFiles.GetEnumerator();
-			while (it.MoveNext())
+            foreach(string s in flushState.flushedFiles)
 			{
-				cfsWriter.AddFile((System.String) ((System.Collections.DictionaryEntry) it.Current).Key);
+				cfsWriter.AddFile(s);
 			}
 			
 			// Perform the merge

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsDocsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsDocsWriter.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsDocsWriter.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsDocsWriter.cs
Sun May  1 18:23:05 2011
@@ -46,7 +46,7 @@ namespace Lucene.Net.Index
 		{
 			this.parent = parent;
 			System.String fileName = IndexFileNames.SegmentFileName(parent.parent.segment, IndexFileNames.FREQ_EXTENSION);
-			SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, fileName);
+			state.flushedFiles.Add(fileName);
 			out_Renamed = parent.parent.dir.CreateOutput(fileName);
 			totalNumDocs = parent.parent.totalNumDocs;
 			

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsFieldsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsFieldsWriter.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsFieldsWriter.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsFieldsWriter.cs
Sun May  1 18:23:05 2011
@@ -48,8 +48,8 @@ namespace Lucene.Net.Index
 			// can provide skip data or not
 			skipListWriter = new DefaultSkipListWriter(termsOut.skipInterval, termsOut.maxSkipLevels,
totalNumDocs, null, null);
 			
-			SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.SegmentFileName(IndexFileNames.TERMS_EXTENSION));
-			SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.SegmentFileName(IndexFileNames.TERMS_INDEX_EXTENSION));
+			state.flushedFiles.Add(state.SegmentFileName(IndexFileNames.TERMS_EXTENSION));
+			state.flushedFiles.Add(state.SegmentFileName(IndexFileNames.TERMS_INDEX_EXTENSION));
 			
 			termsWriter = new FormatPostingsTermsWriter(state, this);
 		}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsPositionsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsPositionsWriter.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsPositionsWriter.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/FormatPostingsPositionsWriter.cs
Sun May  1 18:23:05 2011
@@ -42,7 +42,7 @@ namespace Lucene.Net.Index
 				// At least one field does not omit TF, so create the
 				// prox file
 				System.String fileName = IndexFileNames.SegmentFileName(parent.parent.parent.segment,
IndexFileNames.PROX_EXTENSION);
-				SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, fileName);
+				state.flushedFiles.Add(fileName);
 				out_Renamed = parent.parent.parent.dir.CreateOutput(fileName);
 				parent.skipListWriter.SetProxOutput(out_Renamed);
 			}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/MultiReader.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/MultiReader.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/MultiReader.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/MultiReader.cs Sun May
 1 18:23:05 2011
@@ -38,7 +38,7 @@ namespace Lucene.Net.Index
 		protected internal IndexReader[] subReaders;
 		private int[] starts; // 1st docno for each segment
 		private bool[] decrefOnClose; // remember which subreaders to decRef on close
-		private System.Collections.IDictionary normsCache = new System.Collections.Hashtable();
+        private IDictionary<string, byte[]> normsCache = new SupportClass.Dictionary<string,
byte[]>();
 		private int maxDoc = 0;
 		private int numDocs = - 1;
 		private bool hasDeletions = false;
@@ -344,7 +344,7 @@ namespace Lucene.Net.Index
 			lock (this)
 			{
 				EnsureOpen();
-				byte[] bytes = (byte[]) normsCache[field];
+				byte[] bytes = normsCache[field];
 				if (bytes != null)
 					return bytes; // cache hit
 				if (!HasNorms(field))
@@ -363,7 +363,7 @@ namespace Lucene.Net.Index
 			lock (this)
 			{
 				EnsureOpen();
-				byte[] bytes = (byte[]) normsCache[field];
+				byte[] bytes = normsCache[field];
 				for (int i = 0; i < subReaders.Length; i++)
 				// read from segments
 					subReaders[i].Norms(field, result, offset + starts[i]);
@@ -393,7 +393,7 @@ namespace Lucene.Net.Index
 		
 		protected internal override void  DoSetNorm(int n, System.String field, byte value_Renamed)
 		{
-			lock (normsCache.SyncRoot)
+			lock (normsCache)
 			{
 				normsCache.Remove(field); // clear cache
 			}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/NormsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/NormsWriter.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/NormsWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/NormsWriter.cs Sun May
 1 18:23:05 2011
@@ -104,7 +104,7 @@ namespace Lucene.Net.Index
 			}
 			
 			System.String normsFileName = state.segmentName + "." + IndexFileNames.NORMS_EXTENSION;
-			state.flushedFiles[normsFileName] = normsFileName;
+			state.flushedFiles.Add(normsFileName);
 			IndexOutput normsOut = state.directory.CreateOutput(normsFileName);
 			
 			try

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/PositionBasedTermVectorMapper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/PositionBasedTermVectorMapper.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/PositionBasedTermVectorMapper.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/PositionBasedTermVectorMapper.cs
Sun May  1 18:23:05 2011
@@ -27,11 +27,11 @@ namespace Lucene.Net.Index
 	/// </summary>
 	public class PositionBasedTermVectorMapper:TermVectorMapper
 	{
-		private System.Collections.IDictionary fieldToTerms;
+		private SupportClass.Dictionary<String, SupportClass.Dictionary<int,TVPositionInfo>>
fieldToTerms;
 		
 		private System.String currentField;
 		/// <summary> A Map of Integer and TVPositionInfo</summary>
-		private System.Collections.IDictionary currentPositions;
+		private SupportClass.Dictionary<int,TVPositionInfo> currentPositions;
 		private bool storeOffsets;
 		
 		
@@ -99,10 +99,10 @@ namespace Lucene.Net.Index
 			{
 				//ignoring offsets
 			}
-			fieldToTerms = new System.Collections.Hashtable(numTerms);
+            fieldToTerms = new SupportClass.Dictionary<string, SupportClass.Dictionary<int,
TVPositionInfo>>(numTerms);
 			this.storeOffsets = storeOffsets;
 			currentField = field;
-			currentPositions = new System.Collections.Hashtable();
+            currentPositions = new SupportClass.Dictionary<int, TVPositionInfo>();
 			fieldToTerms[currentField] = currentPositions;
 		}
 		
@@ -111,7 +111,7 @@ namespace Lucene.Net.Index
 		/// </summary>
 		/// <returns> A map between field names and a Map.  The sub-Map key is the position
as the integer, the value is {@link Lucene.Net.Index.PositionBasedTermVectorMapper.TVPositionInfo}.
 		/// </returns>
-		public virtual System.Collections.IDictionary GetFieldToTerms()
+        public virtual SupportClass.Dictionary<String, SupportClass.Dictionary<int,
TVPositionInfo>> GetFieldToTerms()
 		{
 			return fieldToTerms;
 		}

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentWriteState.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentWriteState.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentWriteState.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/SegmentWriteState.cs Sun
May  1 18:23:05 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 using Directory = Lucene.Net.Store.Directory;
 
@@ -31,7 +32,7 @@ namespace Lucene.Net.Index
 		internal int numDocs;
 		internal int termIndexInterval;
 		internal int numDocsInStore;
-		internal System.Collections.Hashtable flushedFiles;
+		internal IList<string> flushedFiles;
 		
 		public SegmentWriteState(DocumentsWriter docWriter, Directory directory, System.String
segmentName, System.String docStoreSegmentName, int numDocs, int numDocsInStore, int termIndexInterval)
 		{
@@ -42,7 +43,7 @@ namespace Lucene.Net.Index
 			this.numDocs = numDocs;
 			this.numDocsInStore = numDocsInStore;
 			this.termIndexInterval = termIndexInterval;
-            flushedFiles = new System.Collections.Hashtable();
+            flushedFiles = new SupportClass.Set<string>();
 		}
 		
 		public virtual System.String SegmentFileName(System.String ext)

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/StoredFieldsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/StoredFieldsWriter.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/StoredFieldsWriter.cs (original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/StoredFieldsWriter.cs Sun
May  1 18:23:05 2011
@@ -106,8 +106,8 @@ namespace Lucene.Net.Index
 					fieldsWriter = null;
 					lastDocID = 0;
 					System.Diagnostics.Debug.Assert(state.docStoreSegmentName != null);
-                    SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName
+ "." + IndexFileNames.FIELDS_EXTENSION);
-                    SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName
+ "." + IndexFileNames.FIELDS_INDEX_EXTENSION);
+                    state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.FIELDS_EXTENSION);
+                    state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);
 					
 					state.docWriter.RemoveOpenFile(state.docStoreSegmentName + "." + IndexFileNames.FIELDS_EXTENSION);
 					state.docWriter.RemoveOpenFile(state.docStoreSegmentName + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/src/core/Index/TermVectorsTermsWriter.cs
Sun May  1 18:23:05 2011
@@ -116,9 +116,9 @@ namespace Lucene.Net.Index
 					if (4 + ((long) state.numDocsInStore) * 16 != state.directory.FileLength(fileName))
 						throw new System.SystemException("after flush: tvx size mismatch: " + state.numDocsInStore
+ " docs vs " + state.directory.FileLength(fileName) + " length in bytes of " + fileName +
" file exists?=" + state.directory.FileExists(fileName));
 					
-					SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName
+ "." + IndexFileNames.VECTORS_INDEX_EXTENSION);
-                    SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName
+ "." + IndexFileNames.VECTORS_FIELDS_EXTENSION);
-					SupportClass.CollectionsHelper.AddIfNotContains(state.flushedFiles, state.docStoreSegmentName
+ "." + IndexFileNames.VECTORS_DOCUMENTS_EXTENSION);
+					state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_INDEX_EXTENSION);
+                    state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_FIELDS_EXTENSION);
+					state.flushedFiles.Add(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_DOCUMENTS_EXTENSION);
 					
 					docWriter.RemoveOpenFile(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_INDEX_EXTENSION);
 					docWriter.RemoveOpenFile(state.docStoreSegmentName + "." + IndexFileNames.VECTORS_FIELDS_EXTENSION);

Modified: incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestPositionBasedTermVectorMapper.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestPositionBasedTermVectorMapper.cs?rev=1098382&r1=1098381&r2=1098382&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestPositionBasedTermVectorMapper.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net_2_9_4g/test/core/Index/TestPositionBasedTermVectorMapper.cs
Sun May  1 18:23:05 2011
@@ -16,6 +16,7 @@
  */
 
 using System;
+using System.Collections.Generic;
 
 using NUnit.Framework;
 
@@ -81,20 +82,19 @@ namespace Lucene.Net.Index
 				System.String token = tokens[i];
 				mapper.Map(token, 1, null, thePositions[i]);
 			}
-			System.Collections.IDictionary map = mapper.GetFieldToTerms();
+            SupportClass.Dictionary<String, SupportClass.Dictionary<int, PositionBasedTermVectorMapper.TVPositionInfo>>
map = mapper.GetFieldToTerms();
 			Assert.IsTrue(map != null, "map is null and it shouldn't be");
 			Assert.IsTrue(map.Count == 1, "map Size: " + map.Count + " is not: " + 1);
-			System.Collections.IDictionary positions = (System.Collections.IDictionary) map["test"];
+            SupportClass.Dictionary<int, PositionBasedTermVectorMapper.TVPositionInfo>
positions = map["test"];
 			Assert.IsTrue(positions != null, "thePositions is null and it shouldn't be");
 			
 			Assert.IsTrue(positions.Count == numPositions, "thePositions Size: " + positions.Count
+ " is not: " + numPositions);
 			System.Collections.BitArray bits = new System.Collections.BitArray((numPositions % 64
== 0?numPositions / 64:numPositions / 64 + 1) * 64);
-			for (System.Collections.IEnumerator iterator = positions.GetEnumerator(); iterator.MoveNext();
)
-			{
-				System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry) iterator.Current;
-				PositionBasedTermVectorMapper.TVPositionInfo info = (PositionBasedTermVectorMapper.TVPositionInfo)
entry.Value;
+            foreach(KeyValuePair<int, PositionBasedTermVectorMapper.TVPositionInfo>
entry in positions)
+            {
+				PositionBasedTermVectorMapper.TVPositionInfo info = entry.Value;
 				Assert.IsTrue(info != null, "info is null and it shouldn't be");
-				int pos = ((System.Int32) entry.Key);
+				int pos = entry.Key;
 				bits.Set(pos, true);
 				Assert.IsTrue(info.Position == pos, info.Position + " does not equal: " + pos);
 				Assert.IsTrue(info.Offsets != null, "info.getOffsets() is null and it shouldn't be");



Mime
View raw message