lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [3/3] lucenenet git commit: Various
Date Sun, 25 Jan 2015 12:28:19 GMT
Various


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/1b806ebf
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/1b806ebf
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/1b806ebf

Branch: refs/heads/master
Commit: 1b806ebf5a3779d93f1b1566003d9b78290d6348
Parents: d0ec50f
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Sun Jan 25 14:27:39 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Sun Jan 25 14:27:39 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Codecs/DocValuesConsumer.cs |  2 +-
 .../Codecs/Lucene3x/Lucene3xNormsProducer.cs    |  6 ++--
 src/Lucene.Net.Core/Index/SegmentCoreReaders.cs |  3 +-
 src/Lucene.Net.Core/Index/SegmentMerger.cs      |  2 +-
 .../Index/BaseIndexFileFormatTestCase.cs        | 31 +++++++++++---------
 .../Index/BaseTermVectorsFormatTestCase.cs      | 12 ++++----
 .../Index/RandomIndexWriter.cs                  |  2 +-
 7 files changed, 31 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b806ebf/src/Lucene.Net.Core/Codecs/DocValuesConsumer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/DocValuesConsumer.cs b/src/Lucene.Net.Core/Codecs/DocValuesConsumer.cs
index ecec5e1..4511064 100644
--- a/src/Lucene.Net.Core/Codecs/DocValuesConsumer.cs
+++ b/src/Lucene.Net.Core/Codecs/DocValuesConsumer.cs
@@ -112,7 +112,7 @@ namespace Lucene.Net.Codecs
         /// The default implementation calls <seealso cref="#addNumericField"/>, passing
         /// an Iterable that merges and filters deleted documents on the fly.
         /// </summary>
-        // LUCENE TO-DO This is a bit wacky
+        // LUCENENET TODO This is a bit wacky
         public virtual void MergeNumericField(FieldInfo fieldInfo, MergeState mergeState,
IList<NumericDocValues> toMerge/*, IList<Bits> docsWithField*/)
         {
             AddNumericField(fieldInfo, GetMergeNumericFieldEnumerable(fieldInfo, mergeState,
toMerge));

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b806ebf/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xNormsProducer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xNormsProducer.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xNormsProducer.cs
index 8dd5fa2..6c7abcc 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xNormsProducer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xNormsProducer.cs
@@ -192,7 +192,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
         // holds a file+offset pointing to a norms, and lazy-loads it
         // to a singleton NumericDocValues instance
-        private class NormsDocValues
+        private sealed class NormsDocValues
         {
             private readonly Lucene3xNormsProducer OuterInstance;
 
@@ -207,7 +207,7 @@ namespace Lucene.Net.Codecs.Lucene3x
                 this.Offset = normSeek;
             }
 
-            internal virtual NumericDocValues Instance
+            internal NumericDocValues Instance
             {
                 get
                 {
@@ -254,7 +254,7 @@ namespace Lucene.Net.Codecs.Lucene3x
 
         public override NumericDocValues GetNumeric(FieldInfo field)
         {
-            NormsDocValues dv = Norms[field.Name];
+            var dv = Norms[field.Name];
             Debug.Assert(dv != null);
             return dv.Instance;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b806ebf/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs b/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
index 570f2cb..6aaf274 100644
--- a/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
+++ b/src/Lucene.Net.Core/Index/SegmentCoreReaders.cs
@@ -224,9 +224,8 @@ namespace Lucene.Net.Index
             IDictionary<string, object> normFields = normsLocal.Get();
 
             object ret;
-            NumericDocValues norms;
             normFields.TryGetValue(fi.Name, out ret);
-            norms = (NumericDocValues)ret;
+            var norms = ret as NumericDocValues;
             if (norms == null)
             {
                 norms = NormsProducer.GetNumeric(fi);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b806ebf/src/Lucene.Net.Core/Index/SegmentMerger.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/SegmentMerger.cs b/src/Lucene.Net.Core/Index/SegmentMerger.cs
index bb7e444..bd78f58 100644
--- a/src/Lucene.Net.Core/Index/SegmentMerger.cs
+++ b/src/Lucene.Net.Core/Index/SegmentMerger.cs
@@ -291,7 +291,7 @@ namespace Lucene.Net.Index
                                 norms = DocValues.EMPTY_NUMERIC;
                             }
                             toMerge.Add(norms);
-                            //docsWithField.Add(new Lucene.Net.Util.Bits_MatchAllBits(reader.MaxDoc));
+                            // LUCENENET TODO docsWithField.Add(new Lucene.Net.Util.Bits_MatchAllBits(reader.MaxDoc));
                         }
                         consumer.MergeNumericField(field, MergeState, toMerge/*, docsWithField*/);
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b806ebf/src/Lucene.Net.TestFramework/Index/BaseIndexFileFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseIndexFileFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseIndexFileFormatTestCase.cs
index 2ce7711..0b31695 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseIndexFileFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseIndexFileFormatTestCase.cs
@@ -97,28 +97,31 @@ namespace Lucene.Net.Index
             // do not use newMergePolicy that might return a MockMergePolicy that ignores
the no-CFS ratio
             MergePolicy mp = NewTieredMergePolicy();
             mp.NoCFSRatio = 0;
-            IndexWriterConfig cfg = (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))).SetUseCompoundFile(false).SetMergePolicy(mp);
-            RandomIndexWriter w = new RandomIndexWriter(Random(), dir, cfg);
-            int numDocs = AtLeast(500);
-            for (int i = 0; i < numDocs; ++i)
+            var cfg = (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))).SetUseCompoundFile(false).SetMergePolicy(mp);
+            using (var w = new RandomIndexWriter(Random(), dir, cfg))
             {
-                Document d = new Document();
-                AddRandomFields(d);
-                w.AddDocument(d);
+                var numDocs = AtLeast(500);
+                for (var i = 0; i < numDocs; ++i)
+                {
+                    var d = new Document();
+                    AddRandomFields(d);
+                    w.AddDocument(d);
+                }
+                w.ForceMerge(1);
+                w.Commit();
             }
-            w.ForceMerge(1);
-            w.Commit();
-            w.Dispose();
             IndexReader reader = DirectoryReader.Open(dir);
 
             Directory dir2 = NewDirectory();
             mp = NewTieredMergePolicy();
             mp.NoCFSRatio = 0;
             cfg = (new IndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random()))).SetUseCompoundFile(false).SetMergePolicy(mp);
-            w = new RandomIndexWriter(Random(), dir2, cfg);
-            w.AddIndexes(reader);
-            w.Commit();
-            w.Dispose();
+
+            using (var w = new RandomIndexWriter(Random(), dir2, cfg))
+            {
+                w.AddIndexes(reader);
+                w.Commit();
+            }
 
             assertEquals(BytesUsedByExtension(dir), BytesUsedByExtension(dir2));
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b806ebf/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
index b873d41..b4397b1 100644
--- a/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Index/BaseTermVectorsFormatTestCase.cs
@@ -155,11 +155,13 @@ namespace Lucene.Net.Index
 
         protected internal virtual FieldType FieldType(Options options)
         {
-            FieldType ft = new FieldType(TextField.TYPE_NOT_STORED);
-            ft.StoreTermVectors = true;
-            ft.StoreTermVectorPositions = (new OptionsWrapper(options)).positions;
-            ft.StoreTermVectorOffsets = (new OptionsWrapper(options)).offsets;
-            ft.StoreTermVectorPayloads = (new OptionsWrapper(options)).payloads;
+            var ft = new FieldType(TextField.TYPE_NOT_STORED)
+            {
+                StoreTermVectors = true,
+                StoreTermVectorPositions = (new OptionsWrapper(options)).positions,
+                StoreTermVectorOffsets = (new OptionsWrapper(options)).offsets,
+                StoreTermVectorPayloads = (new OptionsWrapper(options)).payloads
+            };
             ft.Freeze();
             return ft;
         }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/1b806ebf/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs b/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
index b3f3e40..b4d4370 100644
--- a/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
+++ b/src/Lucene.Net.TestFramework/Index/RandomIndexWriter.cs
@@ -517,7 +517,7 @@ namespace Lucene.Net.Index
 
             public TestPointInfoStream(InfoStream @delegate, TestPoint testPoint)
             {
-                this.@delegate = @delegate == null ? new NullInfoStream() : @delegate;
+                this.@delegate = @delegate ?? new NullInfoStream();
                 this.TestPoint = testPoint;
             }
 


Mime
View raw message