lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [30/50] [abbrv] lucenenet git commit: Suggest.Spell.WordBreakSpellChecker: Made enums into optional parameters so the defaults that were used in Java can be respected without making them nullable.
Date Sun, 02 Oct 2016 14:35:48 GMT
Suggest.Spell.WordBreakSpellChecker: Made enums into optional parameters so the defaults that
were used in Java can be respected without making them nullable.


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

Branch: refs/heads/master
Commit: da1b0ef14ef70d888065e273806b6a123ad15ea3
Parents: cbf66f7
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Sep 18 22:30:51 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Oct 2 17:44:51 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Suggest/Spell/SuggestMode.cs          |  2 +-
 .../Spell/WordBreakSpellChecker.cs                   | 15 +++++----------
 2 files changed, 6 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/da1b0ef1/src/Lucene.Net.Suggest/Spell/SuggestMode.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Spell/SuggestMode.cs b/src/Lucene.Net.Suggest/Spell/SuggestMode.cs
index a782b41..b6f199d 100644
--- a/src/Lucene.Net.Suggest/Spell/SuggestMode.cs
+++ b/src/Lucene.Net.Suggest/Spell/SuggestMode.cs
@@ -26,7 +26,7 @@
         /// <summary>
         /// Generate suggestions only for terms not in the index (default)
         /// </summary>
-        SUGGEST_WHEN_NOT_IN_INDEX,
+        SUGGEST_WHEN_NOT_IN_INDEX = 0, // LUCENENET NOTE: Zero is the default value for an
uninitialized enum - http://stackoverflow.com/a/2409671/181087
 
         /// <summary>
         /// Return only suggested words that are as frequent or more frequent than the

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/da1b0ef1/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs b/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs
index d1d1e0e..24f38ee 100644
--- a/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs
+++ b/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs
@@ -83,20 +83,14 @@ namespace Lucene.Net.Search.Spell
         ///          - default = <see cref="BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY"/>
</param>
         /// <returns> one or more arrays of words formed by breaking up the original
term </returns>
         /// <exception cref="System.IO.IOException"> If there is a low-level I/O error.
</exception>
-        public virtual SuggestWord[][] SuggestWordBreaks(Term term, int maxSuggestions, IndexReader
ir, SuggestMode suggestMode, BreakSuggestionSortMethod sortMethod)
+        public virtual SuggestWord[][] SuggestWordBreaks(Term term, int maxSuggestions, IndexReader
ir, 
+            SuggestMode suggestMode = SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX, 
+            BreakSuggestionSortMethod sortMethod = BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY)
         {
             if (maxSuggestions < 1)
             {
                 return new SuggestWord[0][];
             }
-            if (suggestMode == null)
-            {
-                suggestMode = SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX;
-            }
-            if (sortMethod == null)
-            {
-                sortMethod = BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY;
-            }
 
             int queueInitialCapacity = maxSuggestions > 10 ? 10 : maxSuggestions;
             IComparer<SuggestWordArrayWrapper> queueComparator = sortMethod == BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY

@@ -154,7 +148,8 @@ namespace Lucene.Net.Search.Spell
         /// </summary>
         /// <returns> an array of words generated by combining original terms </returns>
         /// <exception cref="System.IO.IOException"> If there is a low-level I/O error.
</exception>
-        public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int maxSuggestions,
IndexReader ir, SuggestMode suggestMode)
+        public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int maxSuggestions,

+            IndexReader ir, SuggestMode suggestMode = SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX)
         {
             if (maxSuggestions < 1)
             {


Mime
View raw message