You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/06/22 05:25:19 UTC

[18/38] lucenenet git commit: API: Lucene.Net.MultiTermQuery: Removed nested ConstantScoreAutoRewrite class, since it is exactly the same as the non-nested ConstantScoreAutoRewriteClass. Removed the internal constructor from the latter.

API: Lucene.Net.MultiTermQuery: Removed nested ConstantScoreAutoRewrite class, since it is exactly the same as the non-nested ConstantScoreAutoRewriteClass. Removed the internal constructor from the latter.


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

Branch: refs/heads/master
Commit: 07c8801e994e878bdb970187bb0087aba2760615
Parents: 20de987
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Sat Jun 17 15:08:14 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Sat Jun 17 15:37:28 2017 +0700

----------------------------------------------------------------------
 .../Search/TestMultiTermQueryRewrites.cs        |  2 +-
 .../Search/ConstantScoreAutoRewrite.cs          | 17 ++++++++---
 src/Lucene.Net/Search/MultiTermQuery.cs         | 32 +++++++++++---------
 3 files changed, 31 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/07c8801e/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
index 8f681c5..e6e102c 100644
--- a/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
+++ b/src/Lucene.Net.Tests/Search/TestMultiTermQueryRewrites.cs
@@ -167,7 +167,7 @@ namespace Lucene.Net.Search
             CheckDuplicateTerms(new MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite(1024));
 
             // Test auto rewrite (but only boolean mode), so we set the limits to large values to always get a BQ
-            MultiTermQuery.ConstantScoreAutoRewrite rewrite = new MultiTermQuery.ConstantScoreAutoRewrite();
+            ConstantScoreAutoRewrite rewrite = new ConstantScoreAutoRewrite();
             rewrite.TermCountCutoff = int.MaxValue;
             rewrite.DocCountPercent = 100.0;
             CheckDuplicateTerms(rewrite);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/07c8801e/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs b/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs
index 7c4f2a4..aa741b9 100644
--- a/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs
+++ b/src/Lucene.Net/Search/ConstantScoreAutoRewrite.cs
@@ -31,15 +31,24 @@ namespace Lucene.Net.Search
     using TermsEnum = Lucene.Net.Index.TermsEnum;
     using TermState = Lucene.Net.Index.TermState;
 
-    // LUCENENET NOTE: made this class public, since a derived class with the same name is public
+
+    /// <summary>
+    /// A rewrite method that tries to pick the best
+    /// constant-score rewrite method based on term and
+    /// document counts from the query.  If both the number of
+    /// terms and documents is small enough, then 
+    /// <see cref="CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE"/> is used.
+    /// Otherwise, <see cref="CONSTANT_SCORE_FILTER_REWRITE"/> is
+    /// used.
+    /// </summary>
+    // LUCENENET specific: made this class public. In Lucene there was a derived class 
+    // with the same name that was nested within MultiTermQuery, but in .NET it is 
+    // more intuitive if our classes are not nested.
 #if FEATURE_SERIALIZABLE
     [Serializable]
 #endif
     public class ConstantScoreAutoRewrite : TermCollectingRewrite<BooleanQuery>
     {
-        // LUCENENET specific - making constructor internal since the class was meant to be internal
-        internal ConstantScoreAutoRewrite() { }
-
         /// <summary>
         /// Defaults derived from rough tests with a 20.0 million
         /// doc Wikipedia index.  With more than 350 terms in the

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/07c8801e/src/Lucene.Net/Search/MultiTermQuery.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net/Search/MultiTermQuery.cs b/src/Lucene.Net/Search/MultiTermQuery.cs
index 8fbad5e..6c264ca 100644
--- a/src/Lucene.Net/Search/MultiTermQuery.cs
+++ b/src/Lucene.Net/Search/MultiTermQuery.cs
@@ -243,21 +243,23 @@ namespace Lucene.Net.Search
             }
         }
 
-        /// <summary>
-        /// A rewrite method that tries to pick the best
-        /// constant-score rewrite method based on term and
-        /// document counts from the query.  If both the number of
-        /// terms and documents is small enough, then 
-        /// <see cref="CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE"/> is used.
-        /// Otherwise, <see cref="CONSTANT_SCORE_FILTER_REWRITE"/> is
-        /// used.
-        /// </summary>
-#if FEATURE_SERIALIZABLE
-        [Serializable]
-#endif
-        public class ConstantScoreAutoRewrite : Lucene.Net.Search.ConstantScoreAutoRewrite // LUCENENET TODO: API Remove duplicate type with same name (confusing)
-        {
-        }
+        // LUCENENET specific - just use the non-nested class directly. This is 
+        // confusing in .NET.
+//        /// <summary>
+//        /// A rewrite method that tries to pick the best
+//        /// constant-score rewrite method based on term and
+//        /// document counts from the query.  If both the number of
+//        /// terms and documents is small enough, then 
+//        /// <see cref="CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE"/> is used.
+//        /// Otherwise, <see cref="CONSTANT_SCORE_FILTER_REWRITE"/> is
+//        /// used.
+//        /// </summary>
+//#if FEATURE_SERIALIZABLE
+//        [Serializable]
+//#endif
+//        public class ConstantScoreAutoRewrite : Lucene.Net.Search.ConstantScoreAutoRewrite
+//        {
+//        }
 
         /// <summary>
         /// Read-only default instance of