diff --git a/Directory.Build.targets b/Directory.Build.targets index 2e25939523..6da2ebe6b3 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -52,7 +52,6 @@ $(DefineConstants);NETSTANDARD - $(DefineConstants);FEATURE_ARRAYEMPTY $(DefineConstants);FEATURE_CULTUREINFO_CURRENTCULTURE_SETTER $(DefineConstants);FEATURE_ENCODINGPROVIDERS @@ -113,13 +112,6 @@ - - - - $(DefineConstants);FEATURE_ARRAYEMPTY - - - diff --git a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/BaseCharFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/BaseCharFilter.cs index 111003aed1..c44dbea3fc 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/BaseCharFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/CharFilter/BaseCharFilter.cs @@ -1,7 +1,6 @@ // Lucene version compatibility level 4.8.1 using J2N.Numerics; using Lucene.Net.Diagnostics; -using Lucene.Net.Support; using Lucene.Net.Util; using System.Diagnostics; using System.IO; @@ -129,4 +128,4 @@ protected virtual void AddOffCorrectMap(int off, int cumulativeDiff) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs index 8a1a244567..e03cc80430 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs @@ -44,7 +44,7 @@ namespace Lucene.Net.Analysis.Hunspell /// public class Dictionary { - private static readonly char[] NOFLAGS = Arrays.Empty(); + private static readonly char[] NOFLAGS = Array.Empty(); private const string ALIAS_KEY = "AF"; private const string MORPH_ALIAS_KEY = "AM"; @@ -153,7 +153,7 @@ public class Dictionary /// for reading the hunspell dictionary file (won't be disposed). /// Can be thrown while reading from the s /// Can be thrown if the content of the files does not meet expected formats - public Dictionary(Stream affix, Stream dictionary) + public Dictionary(Stream affix, Stream dictionary) : this(affix, new JCG.List() { dictionary }, false) { } @@ -752,12 +752,12 @@ private static Encoding GetSystemEncoding(string encoding) // LUCENENET: CA1822: } // .NET doesn't recognize the encoding without a dash between ISO and the number // https://msdn.microsoft.com/en-us/library/system.text.encodinginfo.getencoding(v=vs.110).aspx - if (encoding.Length > 3 && encoding.StartsWith("ISO", StringComparison.OrdinalIgnoreCase) && + if (encoding.Length > 3 && encoding.StartsWith("ISO", StringComparison.OrdinalIgnoreCase) && encoding[3] != '-') { encoding = "iso-" + encoding.Substring(3); } - // Special case - for codepage 1250-1258, we need to change to + // Special case - for codepage 1250-1258, we need to change to // windows-1251, etc. else if (windowsCodePagePattern.IsMatch(encoding)) { @@ -1285,7 +1285,7 @@ internal override char[] ParseFlags(string rawFlags) for (int i = 0; i < rawFlagParts.Length; i++) { - // note, removing the trailing X/leading I for nepali... what is the rule here?! + // note, removing the trailing X/leading I for nepali... what is the rule here?! string replacement = leadingDigitPattern.Replace(rawFlagParts[i], ""); // note, ignoring empty flags (this happens in danish, for example) if (replacement.Length == 0) @@ -1313,7 +1313,7 @@ internal override char[] ParseFlags(string rawFlags) { if (rawFlags.Length == 0) { - return Arrays.Empty(); // LUCENENET: Optimized char[] creation + return Array.Empty(); // LUCENENET: Optimized char[] creation } StringBuilder builder = new StringBuilder(); @@ -1458,4 +1458,4 @@ internal static void ApplyMappings(FST fst, StringBuilder sb) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Query/QueryAutoStopWordAnalyzer.cs b/src/Lucene.Net.Analysis.Common/Analysis/Query/QueryAutoStopWordAnalyzer.cs index 50c02ac5a5..d05ba334b5 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Query/QueryAutoStopWordAnalyzer.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Query/QueryAutoStopWordAnalyzer.cs @@ -3,8 +3,8 @@ using Lucene.Net.Analysis.Core; using Lucene.Net.Analysis.Util; using Lucene.Net.Index; -using Lucene.Net.Support; using Lucene.Net.Util; +using System; using System.Collections.Generic; using System.IO; using JCG = J2N.Collections.Generic; @@ -30,11 +30,11 @@ namespace Lucene.Net.Analysis.Query /// /// An used primarily at query time to wrap another analyzer and provide a layer of protection - /// which prevents very common words from being passed into queries. + /// which prevents very common words from being passed into queries. /// /// For very large indexes the cost /// of reading TermDocs for a very common word can be high. This analyzer was created after experience with - /// a 38 million doc index which had a term in around 50% of docs and was causing TermQueries for + /// a 38 million doc index which had a term in around 50% of docs and was causing TermQueries for /// this term to take 2 seconds. /// /// @@ -169,9 +169,9 @@ protected override TokenStreamComponents WrapComponents(string fieldName, TokenS /// method calls will be returned /// the stop words identified for a field public string[] GetStopWords(string fieldName) - { + { var stopWords = stopWordsPerField[fieldName]; - return stopWords != null ? stopWords.ToArray() : Arrays.Empty(); + return stopWords != null ? stopWords.ToArray() : Array.Empty(); } /// @@ -192,4 +192,4 @@ public Term[] GetStopWords() return allStopWords.ToArray(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs b/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs index 81c12342c4..ccd0e0bbe9 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Shingle/ShingleFilter.cs @@ -1,6 +1,5 @@ // Lucene version compatibility level 4.8.1 using Lucene.Net.Analysis.TokenAttributes; -using Lucene.Net.Support; using Lucene.Net.Util; using System; using System.Collections.Generic; @@ -29,12 +28,12 @@ namespace Lucene.Net.Analysis.Shingle /// /// A constructs shingles (token n-grams) from a token stream. /// In other words, it creates combinations of tokens as a single token. - /// + /// /// /// For example, the sentence "please divide this sentence into shingles" /// might be tokenized into shingles "please divide", "divide this", /// "this sentence", "sentence into", and "into shingles". - /// + /// /// /// This filter handles position increments > 1 by inserting filler tokens /// (tokens with termtext "_"). It does not handle a position increment of 0. @@ -58,7 +57,7 @@ public sealed class ShingleFilter : TokenFilter public const int DEFAULT_MIN_SHINGLE_SIZE = 2; /// - /// default token type attribute value is "shingle" + /// default token type attribute value is "shingle" /// public const string DEFAULT_TOKEN_TYPE = "shingle"; @@ -131,7 +130,7 @@ public sealed class ShingleFilter : TokenFilter /// /// When the next input stream token has a position increment greater than /// one, it is stored in this field until sufficient filler tokens have been - /// inserted to account for the position increment. + /// inserted to account for the position increment. /// private AttributeSource nextInputStreamToken; @@ -141,7 +140,7 @@ public sealed class ShingleFilter : TokenFilter private bool isNextInputStreamToken = false; /// - /// Whether at least one unigram or shingle has been output at the current + /// Whether at least one unigram or shingle has been output at the current /// position. /// private bool isOutputHere = false; @@ -244,7 +243,7 @@ public void SetOutputUnigrams(bool outputUnigrams) /// /// Note that if outputUnigrams==true, then unigrams are always output, /// regardless of whether any shingles are available. - /// + /// /// /// /// Whether or not to output a single @@ -275,7 +274,7 @@ public void SetMaxShingleSize(int maxShingleSize) /// calling this method. /// /// The unigram output option is independent of the min shingle size. - /// + /// /// /// /// min size of output shingles @@ -308,7 +307,7 @@ public void SetTokenSeparator(string tokenSeparator) /// string to insert at each position where there is no token public void SetFillerToken(string fillerToken) { - this.fillerToken = null == fillerToken ? Arrays.Empty() : fillerToken.ToCharArray(); + this.fillerToken = null == fillerToken ? Array.Empty() : fillerToken.ToCharArray(); } public override bool IncrementToken() @@ -434,7 +433,7 @@ private InputWindowToken GetNextToken(InputWindowToken target) } if (posIncrAtt.PositionIncrement > 1) { - // Each output shingle must contain at least one input token, + // Each output shingle must contain at least one input token, // so no more than (maxShingleSize - 1) filler tokens will be inserted. numFillerTokensToInsert = Math.Min(posIncrAtt.PositionIncrement - 1, maxShingleSize - 1); // Save the current token as the next input stream token @@ -499,7 +498,7 @@ public override void End() } /// - /// Fills with input stream tokens, if available, + /// Fills with input stream tokens, if available, /// shifting to the right if the window was previously full. /// /// @@ -577,7 +576,7 @@ public override void Reset() /// gramSize will take on values from the circular sequence /// { [ 1, ] [ , ... , ] }. /// - /// 1 is included in the circular sequence only if + /// 1 is included in the circular sequence only if /// = true. /// /// @@ -606,7 +605,7 @@ public CircularSequence(ShingleFilter shingleFilter) /// gramSize will take on values from the circular sequence /// { [ 1, ] [ , ... , ] }. /// - /// 1 is included in the circular sequence only if + /// 1 is included in the circular sequence only if /// = true. /// /// @@ -628,13 +627,13 @@ public virtual void Advance() } /// - /// Sets this circular number's value to the first member of the + /// Sets this circular number's value to the first member of the /// circular sequence /// /// gramSize will take on values from the circular sequence /// { [ 1, ] [ , ... , ] }. /// - /// 1 is included in the circular sequence only if + /// 1 is included in the circular sequence only if /// = true. /// /// @@ -650,7 +649,7 @@ public void Reset() /// /// If = true, the first member of the circular /// sequence will be 1; otherwise, it will be . - /// + /// /// /// /// true if the current value is the first member of the circular @@ -685,4 +684,4 @@ public InputWindowToken(AttributeSource attSource) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs index 345ad9ace4..4a390badb1 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/CharArrayMap.cs @@ -46,7 +46,7 @@ namespace Lucene.Net.Analysis.Util /// etc. It is designed to be quick to retrieve items /// by keys without the necessity of converting /// to a first. - /// + /// /// /// You must specify the required /// compatibility when creating : @@ -99,10 +99,10 @@ public class CharArrayDictionary : ICharArrayDictionary, IDictionary don't have a default constructor. /// So, this is a workaround that allows any type regardless of the type of constructor. - /// + /// /// /// Note also that we gain the ability to use value types for , but - /// also create a difference in behavior from Java Lucene where the actual values + /// also create a difference in behavior from Java Lucene where the actual values /// returned could be null. /// /// @@ -260,7 +260,7 @@ internal CharArrayDictionary(CharArrayDictionary toCopy) /// Adds the for the passed in . /// Note that the instance is not added to the dictionary. /// - /// A whose + /// A whose /// will be added for the corresponding . void ICollection>.Add(KeyValuePair item) { @@ -351,8 +351,8 @@ private protected virtual CharArrayDictionary AsReadOnlyImpl() // Hack s } /// - /// Clears all entries in this dictionary. This method is supported for reusing, but not - /// . + /// Clears all entries in this dictionary. This method is supported for reusing, but not + /// . /// public virtual void Clear() { @@ -458,7 +458,7 @@ private void CopyTo(KeyValuePair[] array, int arrayIndex) /// /// true if the chars of starting at - /// are in the + /// are in the /// /// is null. /// or is less than zero. @@ -469,8 +469,8 @@ public virtual bool ContainsKey(char[] text, int startIndex, int length) } /// - /// true if the entire is the same as the - /// being passed in; + /// true if the entire is the same as the + /// being passed in; /// otherwise false. /// /// is null. @@ -483,7 +483,7 @@ public virtual bool ContainsKey(char[] text) } /// - /// true if the is in the ; + /// true if the is in the ; /// otherwise false /// /// is null. @@ -493,7 +493,7 @@ public virtual bool ContainsKey(string text) } /// - /// true if the is in the ; + /// true if the is in the ; /// otherwise false /// /// @@ -897,7 +897,7 @@ public virtual bool Put(T text, TValue value, [MaybeNullWhen(returnValue: tru throw new ArgumentNullException(nameof(text)); if (text is CharArrayCharSequence charArrayCs) - return PutImpl(charArrayCs.Value ?? Arrays.Empty(), value); + return PutImpl(charArrayCs.Value ?? Array.Empty(), value); if (text is StringBuilderCharSequence stringBuilderCs) // LUCENENET: Indexing into a StringBuilder is slow, so materialize { var sb = stringBuilderCs.Value!; @@ -928,7 +928,7 @@ public virtual bool Put(T text, TValue value, [MaybeNullWhen(returnValue: tru // LUCENENET NOTE: Testing for *is* is at least 10x faster // than casting using *as* and then checking for null. - // http://stackoverflow.com/q/1583050/181087 + // http://stackoverflow.com/q/1583050/181087 if (text is string str) return PutImpl(str, value); if (text is char[] charArray) @@ -1291,7 +1291,7 @@ private void SetImpl(ICharSequence text, MapValue value) if (text is CharArrayCharSequence charArrayCs) { - SetImpl(charArrayCs.Value ?? Arrays.Empty(), value); + SetImpl(charArrayCs.Value ?? Array.Empty(), value); return; } if (text is StringBuilderCharSequence stringBuilderCs) // LUCENENET: Indexing into a StringBuilder is slow, so materialize @@ -1904,7 +1904,7 @@ private int GetHashCode(string text) #region For .NET Support LUCENENET /// - /// The Lucene version corresponding to the compatibility behavior + /// The Lucene version corresponding to the compatibility behavior /// that this instance emulates /// public virtual LuceneVersion MatchVersion => matchVersion; @@ -2031,8 +2031,8 @@ public virtual CharArrayDictionary ToCharArrayDictionary(LuceneVersion m /// The text of the value to get. /// The position of the where the target text begins. /// The total length of the . - /// When this method returns, contains the value associated with the specified text, - /// if the text is found; otherwise, the default value for the type of the value parameter. + /// When this method returns, contains the value associated with the specified text, + /// if the text is found; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// true if the contains an element with the specified text; otherwise, false. /// is null. @@ -2054,8 +2054,8 @@ public virtual bool TryGetValue(char[] text, int startIndex, int length, [MaybeN /// Gets the value associated with the specified text. /// /// The text of the value to get. - /// When this method returns, contains the value associated with the specified text, - /// if the text is found; otherwise, the default value for the type of the value parameter. + /// When this method returns, contains the value associated with the specified text, + /// if the text is found; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// true if the contains an element with the specified text; otherwise, false. /// is null. @@ -2078,8 +2078,8 @@ public virtual bool TryGetValue(char[] text, [MaybeNullWhen(returnValue: false)] /// Gets the value associated with the specified text. /// /// The text of the value to get. - /// When this method returns, contains the value associated with the specified text, - /// if the text is found; otherwise, the default value for the type of the value parameter. + /// When this method returns, contains the value associated with the specified text, + /// if the text is found; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// true if the contains an element with the specified text; otherwise, false. /// @@ -2115,8 +2115,8 @@ public virtual bool TryGetValue(ICharSequence text, [MaybeNullWhen(returnValue: /// Gets the value associated with the specified text. /// /// The text of the value to get. - /// When this method returns, contains the value associated with the specified text, - /// if the text is found; otherwise, the default value for the type of the value parameter. + /// When this method returns, contains the value associated with the specified text, + /// if the text is found; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// true if the contains an element with the specified text; otherwise, false. /// is null. @@ -2136,8 +2136,8 @@ public virtual bool TryGetValue(string text, [NotNullWhen(returnValue: false)] o /// Gets the value associated with the specified text. /// /// The text of the value to get. - /// When this method returns, contains the value associated with the specified text, - /// if the text is found; otherwise, the default value for the type of the value parameter. + /// When this method returns, contains the value associated with the specified text, + /// if the text is found; otherwise, the default value for the type of the value parameter. /// This parameter is passed uninitialized. /// true if the contains an element with the specified text; otherwise, false. /// is null. @@ -2247,8 +2247,8 @@ public virtual TValue this[object text] /// /// Gets a collection containing the values in the . - /// This specialized collection can be enumerated in order to read its values and - /// overrides in order to display a string + /// This specialized collection can be enumerated in order to read its values and + /// overrides in order to display a string /// representation of the values. /// public ValueCollection Values @@ -2812,7 +2812,7 @@ public override string ToString() return sb.Append('}').ToString(); } - + // LUCENENET: Removed entrySet because in .NET we use the collection itself as the IEnumerable private CharArraySet? keySet = null; @@ -2824,7 +2824,7 @@ public override string ToString() /// /// Returns an view on the dictionary's keys. - /// The set will use the same as this dictionary. + /// The set will use the same as this dictionary. /// private CharArraySet KeySet { @@ -3213,7 +3213,7 @@ DictionaryEntry IDictionaryEnumerator.Entry #endregion Nested Class: Enumerator - // LUCENENET NOTE: The Java Lucene type MapEntry was removed here because it is not possible + // LUCENENET NOTE: The Java Lucene type MapEntry was removed here because it is not possible // to inherit the value type KeyValuePair{TKey, TValue} in .NET. // LUCENENET: EntrySet class removed because in .NET we get the entries by calling GetEnumerator() on the dictionary. @@ -3318,7 +3318,7 @@ public static CharArrayDictionary Copy(LuceneVersion matchVersio } /// - /// Used by to copy without knowing + /// Used by to copy without knowing /// its generic type. /// internal static CharArrayDictionary Copy(LuceneVersion matchVersion, [DisallowNull] ICharArrayDictionary map) @@ -3715,7 +3715,7 @@ internal static CharReturnType ConvertObjectToChars(T key, out char[] chars, [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static CharReturnType ConvertObjectToChars(T key, out char[] chars, out string str, Span reuse) { - chars = Arrays.Empty(); + chars = Array.Empty(); str = string.Empty; if (key is null) @@ -3757,7 +3757,7 @@ internal static CharReturnType ConvertObjectToChars(T key, out char[] chars, } else if (key is CharArrayCharSequence charArrayCs) { - chars = charArrayCs.Value ?? Arrays.Empty(); + chars = charArrayCs.Value ?? Array.Empty(); return CharReturnType.CharArray; } else if (key is StringBuilderCharSequence stringBuilderCs && stringBuilderCs.HasValue) @@ -3897,4 +3897,4 @@ internal static class SR public const string NotSupported_ReadOnlyCollection = "Collection is read-only."; public const string NotSupported_ValueCollectionSet = "Mutating a value collection derived from a dictionary is not allowed."; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Analysis.Kuromoji/Dict/UserDictionary.cs b/src/Lucene.Net.Analysis.Kuromoji/Dict/UserDictionary.cs index b3f3592ac6..e71052d1c4 100644 --- a/src/Lucene.Net.Analysis.Kuromoji/Dict/UserDictionary.cs +++ b/src/Lucene.Net.Analysis.Kuromoji/Dict/UserDictionary.cs @@ -1,6 +1,5 @@ using J2N.Text; using Lucene.Net.Analysis.Ja.Util; -using Lucene.Net.Support; using Lucene.Net.Util; using Lucene.Net.Util.Fst; using System; @@ -126,7 +125,7 @@ public UserDictionary(TextReader reader) this.data = data.ToArray(/*new string[data.Count]*/); this.segmentations = segmentations.ToArray(/*new int[segmentations.Count][]*/); } - + /// /// Lookup words in text. /// @@ -171,7 +170,7 @@ public int[][] Lookup(char[] chars, int off, int len) public TokenInfoFST FST => fst; - private static readonly int[][] EMPTY_RESULT = Arrays.Empty(); + private static readonly int[][] EMPTY_RESULT = Array.Empty(); /// /// Convert Map of index and wordIdAndLength to array of {wordId, index, length} diff --git a/src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs b/src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs index 0e94c321bc..10994c8b85 100644 --- a/src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs +++ b/src/Lucene.Net.Analysis.Kuromoji/Util/CSVUtil.cs @@ -1,5 +1,4 @@ -using Lucene.Net.Support; -using System; +using System; using System.Text; using System.Text.RegularExpressions; using JCG = J2N.Collections.Generic; @@ -76,7 +75,7 @@ public static string[] Parse(string line) // Validate if (quoteCount % 2 != 0) { - return Arrays.Empty(); + return Array.Empty(); } return result.ToArray(/*new String[result.size()]*/); diff --git a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs index 216b5a8426..4db2ee385f 100644 --- a/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs +++ b/src/Lucene.Net.Analysis.Phonetic/Language/Bm/PhoneticEngine.cs @@ -1,7 +1,6 @@ // commons-codec version compatibility level: 1.9 using J2N.Collections.Generic.Extensions; using J2N.Text; -using Lucene.Net.Support; using Lucene.Net.Util; using System; using System.Collections.Generic; @@ -154,7 +153,7 @@ public void Apply(IPhonemeExpr phonemeExpr, int maxPhonemes) } } } - EXPR_break: { } + EXPR_break: { } this.phonemes.Clear(); this.phonemes.UnionWith(newPhonemes); diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs index 37ea280c58..f459456650 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/LongToEnglishQueryMaker.cs @@ -4,7 +4,6 @@ using Lucene.Net.Benchmarks.ByTask.Utils; using Lucene.Net.QueryParsers.Classic; using Lucene.Net.Search; -using Lucene.Net.Support; using Lucene.Net.Support.Threading; using Lucene.Net.Util; using System; @@ -29,7 +28,7 @@ namespace Lucene.Net.Benchmarks.ByTask.Feeds */ /// - /// Creates queries whose content is a spelled-out number + /// Creates queries whose content is a spelled-out number /// starting from + 10. /// public class Int64ToEnglishQueryMaker : IQueryMaker diff --git a/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs b/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs index 6982a80e15..12b80cde78 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Feeds/ReutersQueryMaker.cs @@ -4,7 +4,6 @@ using Lucene.Net.QueryParsers.Classic; using Lucene.Net.Search; using Lucene.Net.Search.Spans; -using Lucene.Net.Support; using Lucene.Net.Util; using System; using System.Collections.Generic; diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs index e0488ae3c4..6fd4cba208 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/CreateIndexTask.cs @@ -1,7 +1,6 @@ using Lucene.Net.Benchmarks.ByTask.Utils; using Lucene.Net.Codecs; using Lucene.Net.Index; -using Lucene.Net.Support; using Lucene.Net.Util; using System; using System.IO; diff --git a/src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs b/src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs index bfe3c43a6b..e788e211ed 100644 --- a/src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs +++ b/src/Lucene.Net.Benchmark/Support/TagSoup/Parser.cs @@ -10,13 +10,12 @@ // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS // OF ANY KIND, either express or implied; not even the implied warranty // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -// -// +// +// // The TagSoup parser using J2N.Text; using Lucene; -using Lucene.Net.Support; using Sax; using Sax.Ext; using Sax.Helpers; @@ -59,7 +58,7 @@ public class Parser : DefaultHandler, IScanHandler, IXMLReader, ILexicalHandler private const bool DEFAULT_IGNORABLE_WHITESPACE = false; private const bool DEFAULT_CDATA_ELEMENTS = true; - // Feature flags. + // Feature flags. private bool namespaces = DEFAULT_NAMESPACES; private bool ignoreBogons = DEFAULT_IGNORE_BOGONS; @@ -1132,7 +1131,7 @@ private static string[] Split(string val) val = val.Trim(); if (val.Length == 0) { - return Arrays.Empty(); + return Array.Empty(); } var l = new JCG.List(); int s = 0; diff --git a/src/Lucene.Net.Codecs/BlockTerms/TermsIndexWriterBase.cs b/src/Lucene.Net.Codecs/BlockTerms/TermsIndexWriterBase.cs index 4c57c721c1..cc7309ca62 100644 --- a/src/Lucene.Net.Codecs/BlockTerms/TermsIndexWriterBase.cs +++ b/src/Lucene.Net.Codecs/BlockTerms/TermsIndexWriterBase.cs @@ -1,5 +1,4 @@ -using Lucene.Net.Index; -using Lucene.Net.Support; +using Lucene.Net.Index; using Lucene.Net.Util; using System; @@ -26,16 +25,16 @@ namespace Lucene.Net.Codecs.BlockTerms /// Base class for terms index implementations to plug /// into . /// - /// @lucene.experimental + /// @lucene.experimental /// /// public abstract class TermsIndexWriterBase : IDisposable { // LUCENENET specific - optimized empty array creation - internal static readonly short[] EMPTY_INT16S = Arrays.Empty(); + internal static readonly short[] EMPTY_INT16S = Array.Empty(); // LUCENENET specific - optimized empty array creation - internal static readonly int[] EMPTY_INT32S = Arrays.Empty(); + internal static readonly int[] EMPTY_INT32S = Array.Empty(); /// Terms index API for a single field. public abstract class FieldWriter @@ -56,4 +55,4 @@ public void Dispose() protected abstract void Dispose(bool disposing); } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs index 712580e93d..8b8b08e6e0 100644 --- a/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs +++ b/src/Lucene.Net.Codecs/SimpleText/SimpleTextDocValuesReader.cs @@ -1,6 +1,5 @@ using J2N.Text; using Lucene.Net.Diagnostics; -using Lucene.Net.Support; using Lucene.Net.Util; using System; using System.Collections.Generic; @@ -67,7 +66,7 @@ internal SimpleTextDocValuesReader(SegmentReadState state, string ext) data = state.Directory.OpenInput( IndexFileNames.SegmentFileName(state.SegmentInfo.Name, state.SegmentSuffix, ext), state.Context); maxDoc = state.SegmentInfo.DocCount; - + while (true) { ReadLine(); @@ -79,7 +78,7 @@ internal SimpleTextDocValuesReader(SegmentReadState state, string ext) if (Debugging.AssertsEnabled) Debugging.Assert(StartsWith(SimpleTextDocValuesWriter.FIELD), "{0}", new BytesRefFormatter(scratch, BytesRefFormat.UTF8)); var fieldName = StripPrefix(SimpleTextDocValuesWriter.FIELD); var field = new OneField(); - + fields[fieldName] = field; ReadLine(); @@ -98,7 +97,7 @@ internal SimpleTextDocValuesReader(SegmentReadState state, string ext) if (Debugging.AssertsEnabled) Debugging.Assert(StartsWith(SimpleTextDocValuesWriter.PATTERN)); field.Pattern = StripPrefix(SimpleTextDocValuesWriter.PATTERN); field.DataStartFilePointer = data.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream - data.Seek(data.Position + (1 + field.Pattern.Length + 2)*maxDoc); // LUCENENET specific: Renamed from getFilePointer() to match FileStream + data.Seek(data.Position + (1 + field.Pattern.Length + 2) * maxDoc); // LUCENENET specific: Renamed from getFilePointer() to match FileStream } else if (dvType == DocValuesType.BINARY) { @@ -109,7 +108,7 @@ internal SimpleTextDocValuesReader(SegmentReadState state, string ext) if (Debugging.AssertsEnabled) Debugging.Assert(StartsWith(SimpleTextDocValuesWriter.PATTERN)); field.Pattern = StripPrefix(SimpleTextDocValuesWriter.PATTERN); field.DataStartFilePointer = data.Position; - data.Seek(data.Position + (9 + field.Pattern.Length + field.MaxLength + 2)*maxDoc); + data.Seek(data.Position + (9 + field.Pattern.Length + field.MaxLength + 2) * maxDoc); } else if (dvType == DocValuesType.SORTED || dvType == DocValuesType.SORTED_SET) { @@ -126,8 +125,8 @@ internal SimpleTextDocValuesReader(SegmentReadState state, string ext) if (Debugging.AssertsEnabled) Debugging.Assert(StartsWith(SimpleTextDocValuesWriter.ORDPATTERN)); field.OrdPattern = StripPrefix(SimpleTextDocValuesWriter.ORDPATTERN); field.DataStartFilePointer = data.Position; // LUCENENET specific: Renamed from getFilePointer() to match FileStream - data.Seek(data.Position + (9 + field.Pattern.Length + field.MaxLength)*field.NumValues + - (1 + field.OrdPattern.Length)*maxDoc); // LUCENENET specific: Renamed from getFilePointer() to match FileStream + data.Seek(data.Position + (9 + field.Pattern.Length + field.MaxLength) * field.NumValues + + (1 + field.OrdPattern.Length) * maxDoc); // LUCENENET specific: Renamed from getFilePointer() to match FileStream } else { @@ -153,7 +152,7 @@ public override NumericDocValues GetNumeric(FieldInfo fieldInfo) var @in = (IndexInput)data.Clone(); var scratch = new BytesRef(); - + return new NumericDocValuesAnonymousClass(this, field, @in, scratch); } @@ -470,9 +469,9 @@ public override SortedSetDocValues GetSortedSet(FieldInfo fieldInfo) // valid: if (Debugging.AssertsEnabled) Debugging.Assert(field != null); - var input = (IndexInput) data.Clone(); + var input = (IndexInput)data.Clone(); var scratch = new BytesRef(); - + return new SortedSetDocValuesAnonymousClass(this, field, input, scratch); } @@ -491,7 +490,7 @@ public SortedSetDocValuesAnonymousClass(SimpleTextDocValuesReader outerInstance, _field = field; _input = input; _scratch = scratch; - _currentOrds = Arrays.Empty(); + _currentOrds = Array.Empty(); _currentIndex = 0; } @@ -515,7 +514,7 @@ public override void SetDocument(int docID) docID * (1 + _field.OrdPattern.Length)); SimpleTextUtil.ReadLine(_input, _scratch); var ordList = _scratch.Utf8ToString().Trim(); - _currentOrds = ordList.Length == 0 ? Arrays.Empty() : ordList.Split(',').TrimEnd(); + _currentOrds = ordList.Length == 0 ? Array.Empty() : ordList.Split(',').TrimEnd(); _currentIndex = 0; } catch (Exception ioe) when (ioe.IsIOException()) @@ -614,7 +613,7 @@ public override long RamBytesUsed() public override void CheckIntegrity() { var iScratch = new BytesRef(); - var clone = (IndexInput) data.Clone(); + var clone = (IndexInput)data.Clone(); clone.Seek(0); ChecksumIndexInput input = new BufferedChecksumIndexInput(clone); while (true) @@ -627,4 +626,4 @@ public override void CheckIntegrity() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs index 7bd62dc69d..4d83f549df 100644 --- a/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs +++ b/src/Lucene.Net.Expressions/JS/JavascriptLexer.cs @@ -125,7 +125,7 @@ public override void DisplayRecognitionError(string[] tokenNames, RecognitionExc // delegators public virtual Lexer[] GetDelegates() { - return Arrays.Empty(); + return Array.Empty(); } public JavascriptLexer() diff --git a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs index 528b6a88fc..f5e6fe8db7 100644 --- a/src/Lucene.Net.Expressions/JS/JavascriptParser.cs +++ b/src/Lucene.Net.Expressions/JS/JavascriptParser.cs @@ -129,7 +129,7 @@ internal class JavascriptParser : Parser // delegates public virtual Parser[] GetDelegates() { - return Arrays.Empty(); + return Array.Empty(); } public JavascriptParser(CommonTokenStream input) diff --git a/src/Lucene.Net.Facet/FacetsConfig.cs b/src/Lucene.Net.Facet/FacetsConfig.cs index b323bd03c2..8dc74d9b66 100644 --- a/src/Lucene.Net.Facet/FacetsConfig.cs +++ b/src/Lucene.Net.Facet/FacetsConfig.cs @@ -52,21 +52,21 @@ namespace Lucene.Net.Facet /// not require count for the dimension; use /// the setters in this class to change these settings for /// each dim. - /// + /// /// /// NOTE: this configuration is not saved into the /// index, but it's vital, and up to the application to /// ensure, that at search time the provided /// matches what was used during indexing. - /// - /// @lucene.experimental + /// + /// @lucene.experimental /// /// public class FacetsConfig { /// /// Which Lucene field holds the drill-downs and ords (as - /// doc values). + /// doc values). /// public const string DEFAULT_INDEX_FIELD_NAME = "$facets"; @@ -80,8 +80,8 @@ public class FacetsConfig /// /// Holds the configuration for one dimension - /// - /// @lucene.experimental + /// + /// @lucene.experimental /// public sealed class DimConfig { @@ -95,13 +95,13 @@ public sealed class DimConfig /// /// True if the count/aggregate for the entire dimension - /// is required, which is unusual (default is false). + /// is required, which is unusual (default is false). /// public bool RequireDimCount { get; set; } /// /// Actual field where this dimension's facet labels - /// should be indexed + /// should be indexed /// public string IndexFieldName { get; set; } @@ -127,11 +127,11 @@ public FacetsConfig() /// /// Get the default configuration for new dimensions. Useful when - /// the dimension is not known beforehand and may need different + /// the dimension is not known beforehand and may need different /// global default settings, like multivalue = true. /// /// - /// The default configuration to be used for dimensions that + /// The default configuration to be used for dimensions that /// are not yet set in the /// protected virtual DimConfig DefaultDimConfig => DEFAULT_DIM_CONFIG; @@ -159,7 +159,7 @@ public virtual DimConfig GetDimConfig(string dimName) /// /// Pass true if this dimension is hierarchical - /// (has depth > 1 paths). + /// (has depth > 1 paths). /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public virtual void SetHierarchical(string dimName, bool v) @@ -185,7 +185,7 @@ public virtual void SetHierarchical(string dimName, bool v) /// /// Pass true if this dimension may have more than - /// one value per document. + /// one value per document. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public virtual void SetMultiValued(string dimName, bool v) @@ -212,7 +212,7 @@ public virtual void SetMultiValued(string dimName, bool v) /// /// Pass true if at search time you require /// accurate counts of the dimension, i.e. how many - /// hits have this dimension. + /// hits have this dimension. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public virtual void SetRequireDimCount(string dimName, bool v) @@ -239,7 +239,7 @@ public virtual void SetRequireDimCount(string dimName, bool v) /// /// Specify which index field name should hold the /// ordinals for this dimension; this is only used by the - /// taxonomy based facet methods. + /// taxonomy based facet methods. /// public virtual void SetIndexFieldName(string dimName, string indexFieldName) { @@ -279,9 +279,9 @@ private static void CheckSeen(ISet seenDims, string dim) /// /// Translates any added s into normal fields for indexing; - /// only use this version if you did not add any taxonomy-based fields + /// only use this version if you did not add any taxonomy-based fields /// ( or ). - /// + /// /// /// NOTE: you should add the returned document to , not the /// input one! @@ -295,7 +295,7 @@ public virtual Document Build(Document doc) /// /// Translates any added s into normal fields for indexing. - /// + /// /// /// NOTE: you should add the returned document to , not the /// input one! @@ -554,7 +554,7 @@ private static void ProcessAssocFacetFields(ITaxonomyWriter taxoWriter, IDiction /// /// Encodes ordinals into a ; expert: subclass can - /// override this to change encoding. + /// override this to change encoding. /// protected virtual BytesRef DedupAndEncode(Int32sRef ordinals) { @@ -655,7 +655,7 @@ public static string PathToString(string[] path) /// /// Turns the first elements of - /// into an encoded string. + /// into an encoded string. /// public static string PathToString(string[] path, int length) { @@ -690,8 +690,8 @@ public static string PathToString(string[] path, int length) } /// - /// Turns an encoded string (from a previous call to ) - /// back into the original . + /// Turns an encoded string (from a previous call to ) + /// back into the original . /// public static string[] StringToPath(string s) { @@ -699,7 +699,7 @@ public static string[] StringToPath(string s) int length = s.Length; if (length == 0) { - return Arrays.Empty(); + return Array.Empty(); } char[] buffer = new char[length]; @@ -732,4 +732,4 @@ public static string[] StringToPath(string s) return parts.ToArray(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs b/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs index feda3bfd9a..879991338a 100644 --- a/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs +++ b/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs @@ -1,6 +1,5 @@ // Lucene version compatibility level 4.8.1 using J2N.Text; -using Lucene.Net.Support; using System; using System.Collections.Generic; using JCG = J2N.Collections.Generic; @@ -37,20 +36,20 @@ namespace Lucene.Net.Facet.SortedSet /// indexed , /// without require a separate taxonomy index. Faceting is /// a bit slower (~25%), and there is added cost on every - /// open to create a new + /// open to create a new /// . Furthermore, this does /// not support hierarchical facets; only flat (dimension + /// label) facets, but it uses quite a bit less RAM to do /// so. - /// + /// /// NOTE: this class should be instantiated and /// then used from a single thread, because it holds a /// thread-private instance of . - /// + /// /// /// NOTE:: tie-break is by unicode sort order - /// - /// @lucene.experimental + /// + /// @lucene.experimental /// /// public class SortedSetDocValuesFacetCounts : Facets @@ -62,7 +61,7 @@ public class SortedSetDocValuesFacetCounts : Facets /// /// Sparse faceting: returns any dimension that had any - /// hits, topCount labels per dimension. + /// hits, topCount labels per dimension. /// public SortedSetDocValuesFacetCounts(SortedSetDocValuesReaderState state, FacetsCollector hits) { @@ -143,7 +142,7 @@ private FacetResult GetDim(string dim, OrdRange ordRange, int topN) labelValues[i] = new LabelAndValue(parts[1], ordAndValue.Value); } - return new FacetResult(dim, Arrays.Empty(), dimCount, labelValues, childCount); + return new FacetResult(dim, Array.Empty(), dimCount, labelValues, childCount); } /// @@ -319,4 +318,4 @@ public override IList GetAllDims(int topN) return results; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs index 37189a01b8..12b76dea12 100644 --- a/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs +++ b/src/Lucene.Net.Facet/Taxonomy/Directory/DirectoryTaxonomyWriter.cs @@ -5,7 +5,6 @@ using Lucene.Net.Index; using Lucene.Net.Index.Extensions; using Lucene.Net.Store; -using Lucene.Net.Support; using Lucene.Net.Support.Threading; using Lucene.Net.Util; using System; @@ -73,7 +72,7 @@ namespace Lucene.Net.Facet.Taxonomy.Directory /// /// For extending classes that need to control the instance that is used, /// please see class. - /// + /// /// @lucene.experimental /// /// @@ -146,7 +145,7 @@ private static IDictionary ReadCommitData(Directory dir) /// This method is unnecessary if your uses a /// instead of the default /// . When the "native" lock is used, a lock - /// does not stay behind forever when the process using it dies. + /// does not stay behind forever when the process using it dies. /// public static void Unlock(Directory directory) { @@ -211,7 +210,7 @@ public DirectoryTaxonomyWriter(Directory directory, OpenMode openMode, /// If null or missing, is used. /// /// A implementation that can be used to - /// customize the configuration and writer itself that's used to + /// customize the configuration and writer itself that's used to /// store the taxonomy index. /// /// if the taxonomy is corrupted. @@ -234,7 +233,7 @@ public DirectoryTaxonomyWriter(DirectoryTaxonomyIndexWriterFactory indexWriterFa IndexWriterConfig config = indexWriterFactory.CreateIndexWriterConfig(openMode); indexWriter = indexWriterFactory.OpenIndexWriter(dir, config); - // verify (to some extent) that merge policy in effect would preserve category docids + // verify (to some extent) that merge policy in effect would preserve category docids if (indexWriter != null) { if (Debugging.AssertsEnabled) Debugging.Assert(!(indexWriter.Config.MergePolicy is TieredMergePolicy), "for preserving category docids, merging none-adjacent segments is not allowed"); @@ -309,7 +308,7 @@ public DirectoryTaxonomyWriter(DirectoryTaxonomyIndexWriterFactory indexWriterFa /// so a factory approach was used instead. /// - /// Opens a from the internal . + /// Opens a from the internal . /// private void InitReaderManager() { @@ -346,7 +345,7 @@ public DirectoryTaxonomyWriter(Directory directory, OpenMode openMode) /// /// Defines the default to use in constructors /// which do not specify one. - /// + /// /// The current default is constructed /// with the parameters (1024, 0.15f, 3), i.e., the entire taxonomy is /// cached in memory while building it. @@ -626,7 +625,7 @@ private int AddCategoryDocument(FacetLabel categoryPath, int parent) // backward-compatible with existing indexes, we can't just fix what // we write here (e.g., to write parent+2), and need to do a workaround // in the reader (which knows that anyway only category 0 has a parent - // -1). + // -1). parentStream.Set(Math.Max(parent + 1, 1)); Document d = new Document { @@ -714,7 +713,7 @@ private void AddToCache(FacetLabel categoryPath, int id) // If cache.put() returned true, it means the cache was limited in // size, became full, and parts of it had to be evicted. It is // possible that a relatively-new category that isn't yet visible - // to our 'reader' was evicted, and therefore we must now refresh + // to our 'reader' was evicted, and therefore we must now refresh // the reader. RefreshReaderManager(); cacheIsComplete = false; @@ -728,7 +727,7 @@ private void RefreshReaderManager() { // this method is synchronized since it cannot happen concurrently with // addCategoryDocument -- when this method returns, we must know that the - // reader manager's state is current. also, it sets shouldRefresh to false, + // reader manager's state is current. also, it sets shouldRefresh to false, // and this cannot overlap with addCatDoc too. // NOTE: since this method is sync'ed, it can call maybeRefresh, instead of // maybeRefreshBlocking. If ever this is changed, make sure to change the @@ -1031,14 +1030,14 @@ public virtual void AddTaxonomy(Directory taxoDir, IOrdinalMap map) } /// - /// Mapping from old ordinal to new ordinals, used when merging indexes + /// Mapping from old ordinal to new ordinals, used when merging indexes /// wit separate taxonomies. - /// + /// /// merges one or more taxonomies into the given taxonomy /// (this). An is filled for each of the added taxonomies, /// containing the new ordinal (in the merged taxonomy) of each of the /// categories in the old taxonomy. - /// + /// /// There exist two implementations of : and /// . As their names suggest, the former keeps the map in /// memory and the latter in a temporary disk file. Because these maps will @@ -1053,7 +1052,7 @@ public interface IOrdinalMap /// Set the size of the map. This MUST be called before . /// It is assumed (but not verified) that will then be /// called exactly 'size' times, with different origOrdinals between 0 - /// and size - 1. + /// and size - 1. /// void SetSize(int taxonomySize); @@ -1063,7 +1062,7 @@ public interface IOrdinalMap /// /// Call to say that all have been done. - /// In some implementations this might free some resources. + /// In some implementations this might free some resources. /// void AddDone(); @@ -1086,11 +1085,11 @@ public sealed class MemoryOrdinalMap : IOrdinalMap internal int[] map; /// - /// Sole constructor. + /// Sole constructor. /// public MemoryOrdinalMap() { - map = Arrays.Empty(); + map = Array.Empty(); } public void SetSize(int taxonomySize) @@ -1131,7 +1130,7 @@ public sealed class DiskOrdinalMap : IOrdinalMap internal OutputStreamDataOutput @out; /// - /// Sole constructor. + /// Sole constructor. /// public DiskOrdinalMap(string tmpfile) { @@ -1273,11 +1272,11 @@ public virtual void ReplaceTaxonomy(Directory taxoDir) /// /// Expert: returns current index epoch, if this is a - /// near-real-time reader. Used by - /// to support NRT. - /// - /// @lucene.internal + /// near-real-time reader. Used by + /// to support NRT. + /// + /// @lucene.internal /// public long TaxonomyEpoch => indexEpoch; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Grouping/GroupingSearch.cs b/src/Lucene.Net.Grouping/GroupingSearch.cs index db18df0d4e..96b23a068f 100644 --- a/src/Lucene.Net.Grouping/GroupingSearch.cs +++ b/src/Lucene.Net.Grouping/GroupingSearch.cs @@ -108,7 +108,7 @@ private GroupingSearch(string groupField, ValueSource groupFunction, IDictionary /// The number of groups to return from the specified group offset /// the grouped result as a instance /// If any I/O related errors occur - // LUCENENET additional method signature. Makes discovering the return type easier. + // LUCENENET additional method signature. Makes discovering the return type easier. public virtual ITopGroups Search(IndexSearcher searcher, Query query, int groupOffset, int groupLimit) { return Search(searcher, null, query, groupOffset, groupLimit); @@ -124,7 +124,7 @@ public virtual ITopGroups Search(IndexSearcher searcher, Query query, in /// The number of groups to return from the specified group offset /// the grouped result as a instance /// If any I/O related errors occur - // LUCENENET additional method signature. Makes discovering the return type easier. + // LUCENENET additional method signature. Makes discovering the return type easier. public virtual ITopGroups Search(IndexSearcher searcher, Filter filter, Query query, int groupOffset, int groupLimit) { if (groupFunction != null) @@ -382,13 +382,13 @@ protected virtual ITopGroups GroupByField(IndexSearche if (topSearchGroups is null) { // LUCENENET specific - optimized empty array creation - return new TopGroups(Arrays.Empty(), Arrays.Empty(), 0, 0, Arrays.Empty>(), float.NaN); + return new TopGroups(Array.Empty(), Array.Empty(), 0, 0, Array.Empty>(), float.NaN); } int topNInsideGroup = groupDocsOffset + groupDocsLimit; IAbstractSecondPassGroupingCollector secondPassCollector; - - secondPassCollector = new TermSecondPassGroupingCollector(groupField, topSearchGroups as IEnumerable>, + + secondPassCollector = new TermSecondPassGroupingCollector(groupField, topSearchGroups as IEnumerable>, groupSort, sortWithinGroup, topNInsideGroup, includeScores, includeMaxScore, fillSortFields) as IAbstractSecondPassGroupingCollector; @@ -426,7 +426,7 @@ protected virtual ITopGroups GroupByFunction(Index { throw IllegalStateException.Create("groupFunction must be set via the constructor by specifying a ValueSource."); } - + firstPassCollector = new FunctionFirstPassGroupingCollector(groupFunction, valueSourceContext, groupSort, topN); if (allGroups) { @@ -444,7 +444,7 @@ protected virtual ITopGroups GroupByFunction(Index { allGroupHeadsCollector = null; } - + ICollector firstRound; if (allGroupHeads || allGroups) @@ -506,16 +506,16 @@ protected virtual ITopGroups GroupByFunction(Index if (topSearchGroups is null) { // LUCENENET specific - optimized empty array creation - return new TopGroups(Arrays.Empty(), Arrays.Empty(), 0, 0, Arrays.Empty>(), float.NaN); + return new TopGroups(Array.Empty(), Array.Empty(), 0, 0, Array.Empty>(), float.NaN); } int topNInsideGroup = groupDocsOffset + groupDocsLimit; IAbstractSecondPassGroupingCollector secondPassCollector; - + secondPassCollector = new FunctionSecondPassGroupingCollector(topSearchGroups as IEnumerable>, groupSort, sortWithinGroup, topNInsideGroup, includeScores, includeMaxScore, fillSortFields, groupFunction, valueSourceContext) as IAbstractSecondPassGroupingCollector; - + if (cachedCollector != null && cachedCollector.IsCached) { @@ -687,7 +687,7 @@ public virtual GroupingSearch SetAllGroups(bool allGroups) /// If was set to true then all matching groups are returned, otherwise /// an empty collection is returned. /// - /// The group value type. This can be a or a instance. + /// The group value type. This can be a or a instance. /// If grouping by doc block this the group value is always null. /// all matching groups are returned, or an empty collection public virtual ICollection GetAllMatchingGroups() diff --git a/src/Lucene.Net.Grouping/TopGroups.cs b/src/Lucene.Net.Grouping/TopGroups.cs index 60fb8f4c08..721a427645 100644 --- a/src/Lucene.Net.Grouping/TopGroups.cs +++ b/src/Lucene.Net.Grouping/TopGroups.cs @@ -25,8 +25,8 @@ namespace Lucene.Net.Search.Grouping /// /// Represents result returned by a grouping search. - /// - /// @lucene.experimental + /// + /// @lucene.experimental /// public class TopGroups : ITopGroups { @@ -62,7 +62,7 @@ public class TopGroups : ITopGroups /// /// Highest score across all hits, or - /// if scores were not computed. + /// if scores were not computed. /// public float MaxScore { get; private set; } @@ -90,7 +90,7 @@ public TopGroups(ITopGroups oldTopGroups, int? totalGroupCount) } /// - /// LUCENENET specific class used to nest types to mimic the syntax used + /// LUCENENET specific class used to nest types to mimic the syntax used /// by Lucene (that is, without specifying the generic closing type of ) /// public static class TopGroups // LUCENENET specific: CA1052 Static holder types should be Static or NotInheritable @@ -116,11 +116,11 @@ public enum ScoreMergeMode } /// - /// Merges an array of TopGroups, for example obtained from the second-pass + /// Merges an array of TopGroups, for example obtained from the second-pass /// collector across multiple shards. Each TopGroups must have been sorted by the - /// same groupSort and docSort, and the top groups passed to all second-pass + /// same groupSort and docSort, and the top groups passed to all second-pass /// collectors must be the same. - /// + /// /// NOTE: We can't always compute an exact totalGroupCount. /// Documents belonging to a group may occur on more than /// one shard and thus the merged totalGroupCount can be @@ -128,7 +128,7 @@ public enum ScoreMergeMode /// totalGroupCount represents a upper bound. If the documents /// of one group do only reside in one shard then the /// totalGroupCount is exact. - /// + /// /// NOTE: the topDocs in each GroupDocs is actually /// an instance of TopDocsAndShards /// @@ -223,7 +223,7 @@ public static TopGroups Merge(ITopGroups[] shardGroups, Sort groupSort, } else if (docOffset >= mergedTopDocs.ScoreDocs.Length) { - mergedScoreDocs = Arrays.Empty(); + mergedScoreDocs = Array.Empty(); } else { @@ -305,8 +305,8 @@ public interface ITopGroups /// /// Highest score across all hits, or - /// if scores were not computed. + /// if scores were not computed. /// float MaxScore { get; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs index cb93affeae..d7f661da72 100644 --- a/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs +++ b/src/Lucene.Net.Highlighter/PostingsHighlight/PostingsHighlighter.cs @@ -37,13 +37,13 @@ namespace Lucene.Net.Search.PostingsHighlight /// /// Simple highlighter that does not analyze fields nor use - /// term vectors. Instead it requires + /// term vectors. Instead it requires /// . /// /// /// PostingsHighlighter treats the single original document as the whole corpus, and then scores individual - /// passages as if they were documents in this corpus. It uses a to find - /// passages in the text; by default it breaks using (for sentence breaking). + /// passages as if they were documents in this corpus. It uses a to find + /// passages in the text; by default it breaks using (for sentence breaking). /// It then iterates in parallel (merge sorting by offset) through /// the positions of all terms from the query, coalescing those hits that occur in a single passage /// into a , and then scores each Passage using a separate . @@ -65,8 +65,8 @@ namespace Lucene.Net.Search.PostingsHighlight /// IndexableFieldType offsetsType = new IndexableFieldType(TextField.TYPE_STORED); /// offsetsType.IndexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS; /// Field body = new Field("body", "foobar", offsetsType); - /// - /// // retrieve highlights at query time + /// + /// // retrieve highlights at query time /// ICUPostingsHighlighter highlighter = new ICUPostingsHighlighter(); /// Query query = new TermQuery(new Term("body", "highlighting")); /// TopDocs topDocs = searcher.Search(query, n); @@ -245,7 +245,7 @@ public virtual string[] Highlight(string field, Query query, IndexSearcher searc /// searcher that was previously used to execute the query. /// TopDocs containing the summary result documents to highlight. /// - /// keyed on field name, containing the array of formatted snippets + /// keyed on field name, containing the array of formatted snippets /// corresponding to the documents in . /// If no highlights were found for a document, the /// first sentence from the field will be returned. @@ -308,7 +308,7 @@ public virtual IDictionary HighlightFields(string[] fields, Qu /// containing the document IDs to highlight. /// The maximum number of top-N ranked passages per-field used to form the highlighted snippets. /// - /// keyed on field name, containing the array of formatted snippets + /// keyed on field name, containing the array of formatted snippets /// corresponding to the documents in . /// If no highlights were found for a document, the /// first maxPassages from the field will @@ -525,7 +525,7 @@ private IDictionary HighlightField(string field, string[] contents, // check if we should do any multiterm processing Analyzer analyzer = GetIndexAnalyzer(field); - CharacterRunAutomaton[] automata = Arrays.Empty(); + CharacterRunAutomaton[] automata = Array.Empty(); if (analyzer != null) { automata = MultiTermHighlighting.ExtractAutomata(query, field); @@ -601,7 +601,7 @@ private IDictionary HighlightField(string field, string[] contents, return highlights; } - + // algorithm: treat sentence snippets as miniature documents // we can intersect these with the postings lists via BreakIterator.preceding(offset),s // score each sentence as norm(sentenceStartOffset) * sum(weight * tf(freq)) @@ -685,8 +685,8 @@ private Passage[] HighlightDoc(string field, BytesRef[] terms, int contentLength throw new ArgumentException("field '" + field + "' was indexed without offsets, cannot highlight"); } int end = dp.EndOffset; - // LUCENE-5166: this hit would span the content limit... however more valid - // hits may exist (they are sorted by start). so we pretend like we never + // LUCENE-5166: this hit would span the content limit... however more valid + // hits may exist (they are sorted by start). so we pretend like we never // saw this term, it won't cause a passage to be added to passageQueue or anything. if (Debugging.AssertsEnabled) Debugging.Assert(EMPTY.StartOffset == int.MaxValue); if (start < contentLength && end > contentLength) @@ -699,7 +699,7 @@ private Passage[] HighlightDoc(string field, BytesRef[] terms, int contentLength { // finalize current current.score *= scorer.Norm(current.startOffset); - // new sentence: first add 'current' to queue + // new sentence: first add 'current' to queue if (passageQueue.Count == n && current.score < passageQueue.Peek().score) { current.Reset(); // can't compete, just reset it @@ -959,4 +959,4 @@ internal void Reset() } } } -#endif \ No newline at end of file +#endif diff --git a/src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs b/src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs index c1ad713818..697027aecc 100644 --- a/src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs +++ b/src/Lucene.Net.Join/Support/ToParentBlockJoinCollector.cs @@ -33,27 +33,27 @@ namespace Lucene.Net.Join /// BlockJoinQuery clauses, sorted by the /// specified parent . Note that this cannot perform /// arbitrary joins; rather, it requires that all joined - /// documents are indexed as a doc block (using + /// documents are indexed as a doc block (using /// - /// or . + /// or . /// Ie, the join is computed /// at index time. - /// + /// /// The parent must only use /// fields from the parent documents; sorting by field in /// the child documents is not supported. - /// + /// /// You should only use this /// collector if one or more of the clauses in the query is /// a . This collector will find those query /// clauses and record the matching child documents for the /// top scoring parent documents. - /// + /// /// Multiple joins (star join) and nested joins and a mix /// of the two are allowed, as long as in all cases the /// documents corresponding to a single row of each joined /// parent table were indexed as a doc block. - /// + /// /// For the simple star join you can retrieve the /// instance containing each 's /// matching child documents for the top parent groups, @@ -61,7 +61,7 @@ namespace Lucene.Net.Join /// a single query, which will contain two or more /// 's as clauses representing the star join, /// can then retrieve two or more instances. - /// + /// /// For nested joins, the query will run correctly (ie, /// match the right parent and child documents), however, /// because is currently unable to support nesting @@ -69,10 +69,10 @@ namespace Lucene.Net.Join /// are only able to retrieve the of the first /// join. The of the nested joins will not be /// correct. - /// + /// /// See http://lucene.apache.org/core/4_8_0/join/ for a code /// sample. - /// + /// /// @lucene.experimental /// [Obsolete("Use Lucene.Net.Search.Join.ToParentBlockJoinCollector instead. This class will be removed in 4.8.0 release candidate."), System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] @@ -92,7 +92,7 @@ public class ToParentBlockJoinCollector : ICollector private readonly bool trackScores; private int docBase; - private ToParentBlockJoinQuery.BlockJoinScorer[] joinScorers = Arrays.Empty(); + private ToParentBlockJoinQuery.BlockJoinScorer[] joinScorers = Array.Empty(); private AtomicReaderContext currentReaderContext; private Scorer scorer; private bool queueFull; @@ -105,7 +105,7 @@ public class ToParentBlockJoinCollector : ICollector /// Creates a . The provided must /// not be null. If you pass true , all /// ToParentBlockQuery instances must not use - /// . + /// . /// public ToParentBlockJoinCollector(Sort sort, int numParentHits, bool trackScores, bool trackMaxScore) { @@ -527,8 +527,8 @@ private ITopGroups AccumulateGroups(int slot, int offset, int maxDocsPerGro } /// - /// Returns the for the specified BlockJoinQuery. The groupValue of each - /// GroupDocs will be the parent docID for that group. The number of documents within + /// Returns the for the specified BlockJoinQuery. The groupValue of each + /// GroupDocs will be the parent docID for that group. The number of documents within /// each group equals to the total number of matched child documents for that group. /// Returns null if no groups matched. /// @@ -552,4 +552,4 @@ public virtual ITopGroups GetTopGroupsWithAllChildDocs(ToParentBlockJoinQue /// public virtual float MaxScore => maxScore; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs b/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs index 5b3dfbdea3..f37e3c4fb6 100644 --- a/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs +++ b/src/Lucene.Net.Join/ToParentBlockJoinCollector.cs @@ -32,27 +32,27 @@ namespace Lucene.Net.Search.Join /// BlockJoinQuery clauses, sorted by the /// specified parent . Note that this cannot perform /// arbitrary joins; rather, it requires that all joined - /// documents are indexed as a doc block (using + /// documents are indexed as a doc block (using /// - /// or . + /// or . /// Ie, the join is computed /// at index time. - /// + /// /// The parent must only use /// fields from the parent documents; sorting by field in /// the child documents is not supported. - /// + /// /// You should only use this /// collector if one or more of the clauses in the query is /// a . This collector will find those query /// clauses and record the matching child documents for the /// top scoring parent documents. - /// + /// /// Multiple joins (star join) and nested joins and a mix /// of the two are allowed, as long as in all cases the /// documents corresponding to a single row of each joined /// parent table were indexed as a doc block. - /// + /// /// For the simple star join you can retrieve the /// instance containing each 's /// matching child documents for the top parent groups, @@ -60,7 +60,7 @@ namespace Lucene.Net.Search.Join /// a single query, which will contain two or more /// 's as clauses representing the star join, /// can then retrieve two or more instances. - /// + /// /// For nested joins, the query will run correctly (ie, /// match the right parent and child documents), however, /// because is currently unable to support nesting @@ -68,10 +68,10 @@ namespace Lucene.Net.Search.Join /// are only able to retrieve the of the first /// join. The of the nested joins will not be /// correct. - /// + /// /// See http://lucene.apache.org/core/4_8_0/join/ for a code /// sample. - /// + /// /// @lucene.experimental /// public class ToParentBlockJoinCollector : ICollector @@ -90,7 +90,7 @@ public class ToParentBlockJoinCollector : ICollector private readonly bool trackScores; private int docBase; - private ToParentBlockJoinQuery.BlockJoinScorer[] joinScorers = Arrays.Empty(); + private ToParentBlockJoinQuery.BlockJoinScorer[] joinScorers = Array.Empty(); private AtomicReaderContext currentReaderContext; private Scorer scorer; private bool queueFull; @@ -103,7 +103,7 @@ public class ToParentBlockJoinCollector : ICollector /// Creates a . The provided must /// not be null. If you pass true , all /// ToParentBlockQuery instances must not use - /// . + /// . /// public ToParentBlockJoinCollector(Sort sort, int numParentHits, bool trackScores, bool trackMaxScore) { @@ -126,7 +126,7 @@ public ToParentBlockJoinCollector(Sort sort, int numParentHits, bool trackScores private sealed class OneGroup : FieldValueHitQueue.Entry { - public OneGroup(int comparerSlot, int parentDoc, float parentScore, int numJoins, bool doScores) + public OneGroup(int comparerSlot, int parentDoc, float parentScore, int numJoins, bool doScores) : base(comparerSlot, parentDoc, parentScore) { //System.out.println("make OneGroup parentDoc=" + parentDoc); @@ -150,7 +150,7 @@ public OneGroup(int comparerSlot, int parentDoc, float parentScore, int numJoins internal float[][] scores; internal int[] counts; } - + public virtual void Collect(int parentDoc) { //System.out.println("\nC parentDoc=" + parentDoc); @@ -302,7 +302,7 @@ private void CopyGroups(OneGroup og) } } } - + public virtual void SetNextReader(AtomicReaderContext context) { currentReaderContext = context; @@ -509,15 +509,15 @@ private ITopGroups AccumulateGroups(int slot, int offset, int maxDocsPerGro TopDocs topDocs; if (withinGroupSort is null) { - var tempCollector = (TopScoreDocCollector) collector; + var tempCollector = (TopScoreDocCollector)collector; topDocs = tempCollector.GetTopDocs(withinGroupOffset, numDocsInGroup); } else { - var tempCollector = (TopFieldCollector) collector; + var tempCollector = (TopFieldCollector)collector; topDocs = tempCollector.GetTopDocs(withinGroupOffset, numDocsInGroup); } - + groups[groupIdx - offset] = new GroupDocs(og.Score, topDocs.MaxScore, numChildDocs, topDocs.ScoreDocs, og.Doc, groupSortValues); } @@ -525,8 +525,8 @@ private ITopGroups AccumulateGroups(int slot, int offset, int maxDocsPerGro } /// - /// Returns the for the specified BlockJoinQuery. The groupValue of each - /// GroupDocs will be the parent docID for that group. The number of documents within + /// Returns the for the specified BlockJoinQuery. The groupValue of each + /// GroupDocs will be the parent docID for that group. The number of documents within /// each group equals to the total number of matched child documents for that group. /// Returns null if no groups matched. /// @@ -550,4 +550,4 @@ public virtual ITopGroups GetTopGroupsWithAllChildDocs(ToParentBlockJoinQue /// public virtual float MaxScore => maxScore; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Queries/CustomScoreQuery.cs b/src/Lucene.Net.Queries/CustomScoreQuery.cs index 74a04273a8..4b1cd5eb0d 100644 --- a/src/Lucene.Net.Queries/CustomScoreQuery.cs +++ b/src/Lucene.Net.Queries/CustomScoreQuery.cs @@ -49,7 +49,7 @@ public class CustomScoreQuery : Query /// Create a over input . /// the sub query whose scored is being customized. Must not be null. public CustomScoreQuery(Query subQuery) - : this(subQuery, Arrays.Empty()) + : this(subQuery, Array.Empty()) { } @@ -59,7 +59,7 @@ public CustomScoreQuery(Query subQuery) /// a value source query whose scores are used in the custom score /// computation. This parameter is optional - it can be null. public CustomScoreQuery(Query subQuery, FunctionQuery scoringQuery) - : this(subQuery, scoringQuery != null ? new FunctionQuery[] { scoringQuery } : Arrays.Empty()) + : this(subQuery, scoringQuery != null ? new FunctionQuery[] { scoringQuery } : Array.Empty()) // don't want an array that contains a single null.. { } @@ -72,7 +72,7 @@ public CustomScoreQuery(Query subQuery, FunctionQuery scoringQuery) public CustomScoreQuery(Query subQuery, params FunctionQuery[] scoringQueries) { this.subQuery = subQuery; - this.scoringQueries = scoringQueries ?? Arrays.Empty(); + this.scoringQueries = scoringQueries ?? Array.Empty(); if (subQuery is null) { throw new ArgumentNullException(nameof(subQuery), " must not be null!"); // LUCENENET specific - changed from IllegalArgumentException to ArgumentNullException (.NET convention) @@ -247,8 +247,8 @@ public override float GetValueForNormalization() /// public override void Normalize(float norm, float topLevelBoost) { - // note we DONT incorporate our boost, nor pass down any topLevelBoost - // (e.g. from outer BQ), as there is no guarantee that the CustomScoreProvider's + // note we DONT incorporate our boost, nor pass down any topLevelBoost + // (e.g. from outer BQ), as there is no guarantee that the CustomScoreProvider's // function obeys the distributive law... it might call sqrt() on the subQuery score // or some other arbitrary function other than multiplication. // so, instead boosts are applied directly in score() @@ -394,16 +394,16 @@ public override long GetCost() } public override Weight CreateWeight(IndexSearcher searcher) - { + { return new CustomWeight(this, searcher); } /// /// Checks if this is strict custom scoring. /// In strict custom scoring, the part does not participate in weight normalization. - /// This may be useful when one wants full control over how scores are modified, and does + /// This may be useful when one wants full control over how scores are modified, and does /// not care about normalizing by the part. - /// One particular case where this is useful if for testing this query. + /// One particular case where this is useful if for testing this query. /// /// Note: only has effect when the part is not null. /// @@ -429,4 +429,4 @@ public virtual bool IsStrict /// public virtual string Name => "custom"; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Queries/TermsFilter.cs b/src/Lucene.Net.Queries/TermsFilter.cs index c3206cc8d9..3aae8295f3 100644 --- a/src/Lucene.Net.Queries/TermsFilter.cs +++ b/src/Lucene.Net.Queries/TermsFilter.cs @@ -26,7 +26,7 @@ namespace Lucene.Net.Queries * See the License for the specific language governing permissions and * limitations under the License. */ - + /// /// Constructs a filter for docs matching any of the terms added to this class. /// Unlike a RangeFilter this can be used for filtering on multiple terms that are not necessarily in @@ -38,11 +38,11 @@ public sealed class TermsFilter : Filter { /* * this class is often used for large number of terms in a single field. - * to optimize for this case and to be filter-cache friendly we + * to optimize for this case and to be filter-cache friendly we * serialize all terms into a single byte array and store offsets * in a parallel array to keep the # of object constant and speed up * equals / hashcode. - * + * * This adds quite a bit of complexity but allows large term filters to * be efficient for GC and cache-lookups */ @@ -62,7 +62,7 @@ public TermsFilter(IList terms) } private sealed class FieldAndTermEnumAnonymousClass : FieldAndTermEnum - { + { public FieldAndTermEnumAnonymousClass(IList terms) { // LUCENENET specific - added guard clause for null @@ -166,9 +166,9 @@ private TermsFilter(FieldAndTermEnum iter, int length) // TODO: yet another option is to build the union of the terms in // an automaton an call intersect on the termsenum if the density is high - + int hash = 9; - var serializedTerms = Arrays.Empty(); + var serializedTerms = Array.Empty(); this.offsets = new int[length + 1]; int lastEndOffset = 0; int index = 0; @@ -410,4 +410,4 @@ protected FieldAndTermEnum(string field) // LUCENENET: CA1012: Abstract types sh public virtual string Field { get; protected set; } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.QueryParser/Flexible/Core/Messages/QueryParserResourceProvider.cs b/src/Lucene.Net.QueryParser/Flexible/Core/Messages/QueryParserResourceProvider.cs index 0a9633fd00..c91292bf66 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Core/Messages/QueryParserResourceProvider.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Core/Messages/QueryParserResourceProvider.cs @@ -1,5 +1,4 @@ -using Lucene.Net.Support; -using Lucene.Net.Util; +using Lucene.Net.Util; using System; using System.Collections.Generic; using System.ComponentModel; @@ -48,7 +47,7 @@ public class QueryParserResourceProvider : IResourceProvider /// Initializes a new instance of the class with default values. /// public QueryParserResourceProvider() - : this((IList)Arrays.Empty()) + : this((IList)Array.Empty()) { } diff --git a/src/Lucene.Net.QueryParser/Flexible/Messages/MessageImpl.cs b/src/Lucene.Net.QueryParser/Flexible/Messages/MessageImpl.cs index 9033630a93..99c87f3c54 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Messages/MessageImpl.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Messages/MessageImpl.cs @@ -36,7 +36,7 @@ // { // private readonly string key; // LUCENENET: marked readonly -// private readonly object[] arguments = Arrays.Empty(); // LUCENENET: marked readonly +// private readonly object[] arguments = Array.Empty(); // LUCENENET: marked readonly // public Message(string key) // { diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs index 28a37edfb1..18c0fa322a 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/StandardQueryParser.cs @@ -66,7 +66,7 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard /// enables one to construct queries which search multiple fields. /// /// - /// + /// /// A clause may be either: /// /// @@ -77,13 +77,13 @@ namespace Lucene.Net.QueryParsers.Flexible.Standard /// a +/- prefix to require any of a set of terms. /// /// - /// + /// /// Thus, in BNF, the query grammar is: /// /// Query ::= ( Clause )* /// Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" ) /// - /// + /// /// /// Examples of appropriately formatted queries can be found in the query syntax documentation. /// @@ -212,7 +212,7 @@ public virtual bool EnablePositionIncrements } /// - /// By default, it uses + /// By default, it uses /// when creating a /// prefix, wildcard and range queries. This implementation is generally /// preferable because it a) Runs faster b) Does not have the scarcity of terms @@ -237,7 +237,7 @@ public virtual void SetMultiFields(string[] fields) if (fields is null) { - fields = Arrays.Empty(); + fields = Array.Empty(); } QueryConfigHandler.Set(ConfigurationKeys.MULTI_FIELDS, fields); diff --git a/src/Lucene.Net.QueryParser/Surround/Query/SpanNearClauseFactory.cs b/src/Lucene.Net.QueryParser/Surround/Query/SpanNearClauseFactory.cs index eac847fc39..d1aea2a8c8 100644 --- a/src/Lucene.Net.QueryParser/Surround/Query/SpanNearClauseFactory.cs +++ b/src/Lucene.Net.QueryParser/Surround/Query/SpanNearClauseFactory.cs @@ -1,5 +1,4 @@ -using Lucene.Net.Diagnostics; -using Lucene.Net.Index; +using Lucene.Net.Index; using Lucene.Net.Search.Spans; using System; using System.Collections.Generic; @@ -28,14 +27,14 @@ namespace Lucene.Net.QueryParsers.Surround.Query /// SpanNearClauseFactory: /// /// Operations: - /// + /// /// /// create for a field name and an indexreader. - /// + /// /// add a weighted Term - this should add a corresponding SpanTermQuery, or increase the weight of an existing one. - /// + /// /// add a weighted subquery SpanNearQuery - /// + /// /// create a clause for SpanNearQuery from the things added above. /// /// @@ -57,17 +56,18 @@ namespace Lucene.Net.QueryParsers.Surround.Query /// via getTerms(); are the corresponding weights available? /// - SpanFirstQuery: treat similar to subquery SpanNearQuery. (ok?) /// - SpanNotQuery: treat similar to subquery SpanNearQuery. (ok?) - /// + /// /// Factory for /// public class SpanNearClauseFactory { - public SpanNearClauseFactory(IndexReader reader, string fieldName, BasicQueryFactory qf) { + public SpanNearClauseFactory(IndexReader reader, string fieldName, BasicQueryFactory qf) + { this.reader = reader; this.fieldName = fieldName; this.weightBySpanQuery = new JCG.Dictionary(); this.qf = qf; - } + } private readonly IndexReader reader; // LUCENENET: marked readonly private readonly string fieldName; // LUCENENET: marked readonly diff --git a/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs b/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs index a018bf7a7f..58e9f4a88a 100644 --- a/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs +++ b/src/Lucene.Net.QueryParser/Surround/Query/SrndQuery.cs @@ -1,5 +1,4 @@ using Lucene.Net.Search; -using Lucene.Net.Support; using System; using System.Globalization; using System.Text; @@ -25,7 +24,7 @@ namespace Lucene.Net.QueryParsers.Surround.Query */ /// - /// Lowest level base class for surround queries + /// Lowest level base class for surround queries /// public abstract class SrndQuery // LUCENENET specific: Not implementing ICloneable per Microsoft's recommendation { @@ -36,8 +35,8 @@ public abstract class SrndQuery // LUCENENET specific: Not implementing ICloneab public virtual bool IsWeighted => weighted; - public virtual float Weight - { + public virtual float Weight + { get => weight; set { @@ -51,7 +50,7 @@ public virtual float Weight public virtual string WeightOperator => "^"; protected virtual void WeightToString(StringBuilder r) - { + { /* append the weight part of a query */ if (IsWeighted) { @@ -65,7 +64,7 @@ public virtual Search.Query MakeLuceneQueryField(string fieldName, BasicQueryFac Search.Query q = MakeLuceneQueryFieldNoBoost(fieldName, qf); if (IsWeighted) { - q.Boost=(Weight * q.Boost); /* weight may be at any level in a SrndQuery */ + q.Boost = (Weight * q.Boost); /* weight may be at any level in a SrndQuery */ } return q; } @@ -113,8 +112,8 @@ public override bool Equals(object obj) } /// An empty Lucene query - public readonly static Search.Query TheEmptyLcnQuery = new EmptyLcnQuery(); /* no changes allowed */ - + public readonly static Search.Query TheEmptyLcnQuery = new EmptyLcnQuery(); /* no changes allowed */ + internal sealed class EmptyLcnQuery : BooleanQuery { public override float Boost diff --git a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs index b2aa90e23a..3c5da3287c 100644 --- a/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs +++ b/src/Lucene.Net.Sandbox/Queries/FuzzyLikeThisQuery.cs @@ -3,7 +3,6 @@ using Lucene.Net.Index; using Lucene.Net.Search; using Lucene.Net.Search.Similarities; -using Lucene.Net.Support; using Lucene.Net.Util; using System; using System.Collections.Generic; @@ -33,14 +32,14 @@ namespace Lucene.Net.Sandbox.Queries /// Fuzzifies ALL terms provided as strings and then picks the best n differentiating terms. /// In effect this mixes the behaviour of and MoreLikeThis but with special consideration /// of fuzzy scoring factors. - /// This generally produces good results for queries where users may provide details in a number of + /// This generally produces good results for queries where users may provide details in a number of /// fields and have no knowledge of boolean query syntax and also want a degree of fuzzy matching and /// a fast query. /// /// For each source term the fuzzy variants are held in a with no coord factor (because /// we are not looking for matches on multiple variants in any one doc). Additionally, a specialized - /// is used for variants and does not use that variant term's IDF because this would favour rarer - /// terms eg misspellings. Instead, all variants use the same IDF ranking (the one for the source query + /// is used for variants and does not use that variant term's IDF because this would favour rarer + /// terms eg misspellings. Instead, all variants use the same IDF ranking (the one for the source query /// term) and this is factored into the variant's boost. If the source query term does not exist in the /// index the average IDF of the variants is used. /// @@ -48,7 +47,7 @@ public class FuzzyLikeThisQuery : Query { // TODO: generalize this query (at least it should not reuse this static sim! // a better way might be to convert this into multitermquery rewrite methods. - // the rewrite method can 'average' the TermContext's term statistics (docfreq,totalTermFreq) + // the rewrite method can 'average' the TermContext's term statistics (docfreq,totalTermFreq) // provided to TermQuery, so that the general idea is agnostic to any scoring system... internal static TFIDFSimilarity sim = new DefaultSimilarity(); private Query rewrittenQuery = null; @@ -107,7 +106,7 @@ public override bool Equals(object obj) } /// - /// + /// /// /// The total number of terms clauses that will appear once rewritten as a /// @@ -178,7 +177,7 @@ public override bool Equals(object obj) } /// - /// Adds user input for "fuzzification" + /// Adds user input for "fuzzification" /// /// The string which will be parsed by the analyzer and for which fuzzy variants will be parsed /// The minimum similarity of the term variants (see ) @@ -323,7 +322,7 @@ public override Query Rewrite(IndexReader reader) // found a match Query tq = ignoreTF ? (Query)new ConstantScoreQuery(new TermQuery(st.Term)) : new TermQuery(st.Term, 1); tq.Boost = st.Score; // set the boost using the ScoreTerm's score - termVariants.Add(tq, Occur.SHOULD); // add to query + termVariants.Add(tq, Occur.SHOULD); // add to query } bq.Add(termVariants, Occur.SHOULD); // add to query } diff --git a/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs b/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs index 67a184f364..ff3a185ca1 100644 --- a/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs +++ b/src/Lucene.Net.Suggest/Spell/DirectSpellChecker.cs @@ -39,12 +39,12 @@ namespace Lucene.Net.Search.Spell /// /// A practical benefit of this spellchecker is that it requires no additional /// datastructures (neither in RAM nor on disk) to do its work. - /// + /// /// /// /// /// - /// + /// /// @lucene.experimental public class DirectSpellChecker { @@ -72,7 +72,7 @@ public class DirectSpellChecker private float accuracy = SpellChecker.DEFAULT_ACCURACY; /// /// value in [0..1] (or absolute number >=1) representing the minimum - /// number of documents (of the total) where a term should appear. + /// number of documents (of the total) where a term should appear. /// private float thresholdFrequency = 0f; /// @@ -81,7 +81,7 @@ public class DirectSpellChecker /// /// value in [0..1] (or absolute number >=1) representing the maximum /// number of documents (of the total) a query term can appear in to - /// be corrected. + /// be corrected. /// private float maxQueryFrequency = 0.01f; /// @@ -100,7 +100,7 @@ public class DirectSpellChecker private CultureInfo lowerCaseTermsCulture = null; // LUCENENET specific /// - /// Creates a DirectSpellChecker with default configuration values + /// Creates a DirectSpellChecker with default configuration values /// public DirectSpellChecker() { @@ -109,7 +109,7 @@ public DirectSpellChecker() /// /// Gets or sets the maximum number of Levenshtein edit-distances to draw /// candidate terms from.This value can be 1 or 2. The default is 2. - /// + /// /// Note: a large number of spelling errors occur with an edit distance /// of 1, by setting this value to 1 you can increase both performance /// and precision at the cost of recall. @@ -130,8 +130,8 @@ public virtual int MaxEdits /// /// Gets or sets the minimal number of characters that must match exactly. - /// - /// This can improve both performance and accuracy of results, + /// + /// This can improve both performance and accuracy of results, /// as misspellings are commonly not the first character. /// public virtual int MinPrefix @@ -143,8 +143,8 @@ public virtual int MinPrefix /// /// Get the maximum number of top-N inspections per suggestion. - /// - /// Increasing this number can improve the accuracy of results, at the cost + /// + /// Increasing this number can improve the accuracy of results, at the cost /// of performance. /// public virtual int MaxInspections @@ -155,7 +155,7 @@ public virtual int MaxInspections /// - /// Gets or sets the minimal accuracy required (default: 0.5f) from a StringDistance + /// Gets or sets the minimal accuracy required (default: 0.5f) from a StringDistance /// for a suggestion match. /// public virtual float Accuracy @@ -205,7 +205,7 @@ public virtual int MinQueryLength /// - /// Gets or sets the maximum threshold (default: 0.01f) of documents a query term can + /// Gets or sets the maximum threshold (default: 0.01f) of documents a query term can /// appear in order to provide suggestions. /// /// Very high-frequency terms are typically spelled correctly. Additionally, @@ -258,7 +258,7 @@ public virtual CultureInfo LowerCaseTermsCulture // LUCENENET specific /// /// Gets or sets the comparer for sorting suggestions. - /// The default is + /// The default is /// public virtual IComparer Comparer { @@ -275,7 +275,7 @@ public virtual IComparer Comparer /// dictionary using Damerau-Levenshtein, it works best with an edit-distance-like /// string metric. If you use a different metric than the default, /// you might want to consider increasing - /// to draw more candidates for your metric to rank. + /// to draw more candidates for your metric to rank. /// public virtual IStringDistance Distance { @@ -304,7 +304,7 @@ public virtual SuggestWord[] SuggestSimilar(Term term, int numSug, IndexReader i /// /// Suggest similar words. - /// + /// /// /// Unlike , the similarity used to fetch the most /// relevant terms is an edit distance, therefore typically a low value @@ -318,14 +318,14 @@ public virtual SuggestWord[] SuggestSimilar(Term term, int numSug, IndexReader i /// return only suggested words that match with this similarity /// sorted list of the suggested words according to the comparer /// If there is a low-level I/O error. - public virtual SuggestWord[] SuggestSimilar(Term term, int numSug, IndexReader ir, + public virtual SuggestWord[] SuggestSimilar(Term term, int numSug, IndexReader ir, SuggestMode suggestMode, float accuracy) { CharsRef spare = new CharsRef(); string text = term.Text; if (minQueryLength > 0 && text.CodePointCount(0, text.Length) < minQueryLength) { - return Arrays.Empty(); + return Array.Empty(); } if (lowerCaseTerms) @@ -337,18 +337,18 @@ public virtual SuggestWord[] SuggestSimilar(Term term, int numSug, IndexReader i if (suggestMode == SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX && docfreq > 0) { - return Arrays.Empty(); + return Array.Empty(); } int maxDoc = ir.MaxDoc; if (maxQueryFrequency >= 1f && docfreq > maxQueryFrequency) { - return Arrays.Empty(); + return Array.Empty(); } else if (docfreq > (int)Math.Ceiling(maxQueryFrequency * maxDoc)) { - return Arrays.Empty(); + return Array.Empty(); } if (suggestMode != SuggestMode.SUGGEST_MORE_POPULAR) @@ -418,7 +418,7 @@ public virtual SuggestWord[] SuggestSimilar(Term term, int numSug, IndexReader i /// a chars scratch /// a collection of spelling corrections sorted by ScoreTerm's natural order. /// If I/O related errors occur - protected internal virtual ICollection SuggestSimilar(Term term, int numSug, IndexReader ir, + protected internal virtual ICollection SuggestSimilar(Term term, int numSug, IndexReader ir, int docfreq, int editDistance, float accuracy, CharsRef spare) { @@ -589,4 +589,4 @@ public override bool Equals(object obj) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs b/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs index fed3d1cd3c..ab2049ebe9 100644 --- a/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs +++ b/src/Lucene.Net.Suggest/Spell/WordBreakSpellChecker.cs @@ -88,25 +88,25 @@ public enum BreakSuggestionSortMethod /// - default = /// one or more arrays of words formed by breaking up the original term /// If there is a low-level I/O error. - public virtual SuggestWord[][] SuggestWordBreaks(Term term, int maxSuggestions, IndexReader ir, - SuggestMode suggestMode = SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX, + 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 Arrays.Empty(); + return Array.Empty(); } int queueInitialCapacity = maxSuggestions > 10 ? 10 : maxSuggestions; - IComparer queueComparer = sortMethod == BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY - ? (IComparer)LengthThenMaxFreqComparer.Default + IComparer queueComparer = sortMethod == BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY + ? (IComparer)LengthThenMaxFreqComparer.Default : LengthThenSumFreqComparer.Default; JCG.PriorityQueue suggestions = new JCG.PriorityQueue(queueInitialCapacity, queueComparer); int origFreq = ir.DocFreq(term); if (origFreq > 0 && suggestMode == SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX) { - return Arrays.Empty(); + return Array.Empty(); } int useMinSuggestionFrequency = minSuggestionFrequency; @@ -115,7 +115,7 @@ public virtual SuggestWord[][] SuggestWordBreaks(Term term, int maxSuggestions, useMinSuggestionFrequency = (origFreq == 0 ? 1 : origFreq); } - GenerateBreakUpSuggestions(term, ir, 1, maxSuggestions, useMinSuggestionFrequency, Arrays.Empty(), suggestions, 0, sortMethod); + GenerateBreakUpSuggestions(term, ir, 1, maxSuggestions, useMinSuggestionFrequency, Array.Empty(), suggestions, 0, sortMethod); SuggestWord[][] suggestionArray = new SuggestWord[suggestions.Count][]; for (int i = suggestions.Count - 1; i >= 0; i--) @@ -153,12 +153,12 @@ public virtual SuggestWord[][] SuggestWordBreaks(Term term, int maxSuggestions, /// /// an array of words generated by combining original terms /// If there is a low-level I/O error. - public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int maxSuggestions, + public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int maxSuggestions, IndexReader ir, SuggestMode suggestMode = SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX) { if (maxSuggestions < 1) { - return Arrays.Empty(); + return Array.Empty(); } int[] origFreqs = null; @@ -261,9 +261,9 @@ public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int max return combineSuggestions; } - private int GenerateBreakUpSuggestions(Term term, IndexReader ir, - int numberBreaks, int maxSuggestions, int useMinSuggestionFrequency, - SuggestWord[] prefix, JCG.PriorityQueue suggestions, + private int GenerateBreakUpSuggestions(Term term, IndexReader ir, + int numberBreaks, int maxSuggestions, int useMinSuggestionFrequency, + SuggestWord[] prefix, JCG.PriorityQueue suggestions, int totalEvaluations, BreakSuggestionSortMethod sortMethod) { string termText = term.Text; @@ -301,9 +301,9 @@ private int GenerateBreakUpSuggestions(Term term, IndexReader ir, int newNumberBreaks = numberBreaks + 1; if (newNumberBreaks <= maxChanges) { - int evaluations = GenerateBreakUpSuggestions(new Term(term.Field, rightWord.String), - ir, newNumberBreaks, maxSuggestions, - useMinSuggestionFrequency, NewPrefix(prefix, leftWord), + int evaluations = GenerateBreakUpSuggestions(new Term(term.Field, rightWord.String), + ir, newNumberBreaks, maxSuggestions, + useMinSuggestionFrequency, NewPrefix(prefix, leftWord), suggestions, totalEvaluations, sortMethod); totalEvaluations += evaluations; } @@ -358,7 +358,7 @@ private static SuggestWord GenerateSuggestWord(IndexReader ir, string fieldname, } /// - /// Gets or sets the minimum frequency a term must have to be + /// Gets or sets the minimum frequency a term must have to be /// included as part of a suggestion. Default=1 Not applicable when used with /// /// @@ -369,7 +369,7 @@ public virtual int MinSuggestionFrequency } /// - /// Gets or sets the maximum length of a suggestion made + /// Gets or sets the maximum length of a suggestion made /// by combining 1 or more original terms. Default=20. /// public virtual int MaxCombineWordLength @@ -388,7 +388,7 @@ public virtual int MinBreakWordLength } /// - /// Gets or sets the maximum numbers of changes (word breaks or combinations) to make + /// Gets or sets the maximum numbers of changes (word breaks or combinations) to make /// on the original term(s). Default=1. /// public virtual int MaxChanges @@ -526,4 +526,4 @@ public int CompareTo(CombineSuggestionWrapper other) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs index 3992a1ee4a..a2a4f90387 100644 --- a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs +++ b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletion.cs @@ -1,5 +1,4 @@ using Lucene.Net.Diagnostics; -using Lucene.Net.Support; using Lucene.Net.Util; using Lucene.Net.Util.Fst; using System; @@ -120,7 +119,7 @@ public FSTCompletion(FST automaton, bool higherWeightsFirst, bool exactF } else { - this.rootArcs = Arrays.Empty>(); + this.rootArcs = Array.Empty>(); } this.higherWeightsFirst = higherWeightsFirst; this.exactFirst = exactFirst; @@ -339,14 +338,14 @@ private JCG.List LookupSortedByWeight(BytesRef key, int num, bool co /// to the first /// position. /// - /// + /// /// Returns true if and only if contained /// . /// private static bool CheckExistingAndReorder(IList list, BytesRef key) // LUCENENET: CA1822: Mark members as static { // We assume list does not have duplicates (because of how the FST is created). - for (int i = list.Count; --i >= 0; ) + for (int i = list.Count; --i >= 0;) { if (key.Equals(list[i].Utf8)) { @@ -406,7 +405,7 @@ private bool Collect(IList res, int num, int bucket, BytesRef output output.Bytes = ArrayUtil.Grow(output.Bytes); } if (Debugging.AssertsEnabled) Debugging.Assert(output.Offset == 0); - output.Bytes[output.Length++] = (byte) arc.Label; + output.Bytes[output.Length++] = (byte)arc.Label; FST.BytesReader fstReader = automaton.GetBytesReader(); automaton.ReadFirstTargetArc(arc, arc, fstReader); while (true) @@ -457,4 +456,4 @@ public virtual int GetBucket(string key) /// public virtual FST FST => automaton; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs index 0d48fdc9ca..fcb1603d98 100644 --- a/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs +++ b/src/Lucene.Net.Suggest/Suggest/Fst/FSTCompletionLookup.cs @@ -30,29 +30,29 @@ namespace Lucene.Net.Search.Suggest.Fst /// /// An adapter from API to . - /// + /// /// This adapter differs from in that it attempts /// to discretize any "weights" as passed from in /// to match the number of buckets. For the rationale for bucketing, see /// . - /// + /// /// /// Note:Discretization requires an additional sorting pass. - /// + /// /// - /// The range of weights for bucketing/ discretization is determined + /// The range of weights for bucketing/ discretization is determined /// by sorting the input by weight and then dividing into - /// equal ranges. Then, scores within each range are assigned to that bucket. - /// + /// equal ranges. Then, scores within each range are assigned to that bucket. + /// /// - /// Note that this means that even large differences in weights may be lost + /// Note that this means that even large differences in weights may be lost /// during automaton construction, but the overall distinction between "classes" - /// of weights will be preserved regardless of the distribution of weights. - /// + /// of weights will be preserved regardless of the distribution of weights. + /// /// /// For fine-grained control over which weights are assigned to which buckets, /// use directly or , for example. - /// + /// /// /// /// @@ -68,9 +68,9 @@ public class FSTCompletionLookup : Lookup /// /// Shared tail length for conflating in the created automaton. Setting this - /// to larger values () will create smaller (or minimal) - /// automata at the cost of RAM for keeping nodes hash in the . - /// + /// to larger values () will create smaller (or minimal) + /// automata at the cost of RAM for keeping nodes hash in the . + /// /// Empirical pick. /// /// @@ -126,7 +126,7 @@ public FSTCompletionLookup(int buckets, bool exactMatchFirst) /// /// This constructor takes a pre-built automaton. /// - /// + /// /// An instance of . /// /// If true exact matches are promoted to the top of the @@ -166,7 +166,7 @@ public override void Build(IInputEnumerator enumerator) count = 0; try { - byte[] buffer = Arrays.Empty(); + byte[] buffer = Array.Empty(); ByteArrayDataOutput output = new ByteArrayDataOutput(buffer); BytesRef spare; while (enumerator.MoveNext()) @@ -350,4 +350,4 @@ public override long GetSizeInBytes() public override long Count => count; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs b/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs index 74002753e0..c04b4169d2 100644 --- a/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs +++ b/src/Lucene.Net.Suggest/Suggest/SortedInputIterator.cs @@ -1,7 +1,7 @@ using Lucene.Net.Store; -using Lucene.Net.Support; using Lucene.Net.Support.IO; using Lucene.Net.Util; +using System; using System.Collections.Generic; using System.IO; using JCG = J2N.Collections.Generic; @@ -48,7 +48,7 @@ public class SortedInputEnumerator : IInputEnumerator /// /// Creates a new sorted wrapper, using - /// for sorting. + /// for sorting. /// public SortedInputEnumerator(IInputEnumerator source) : this(source, BytesRef.UTF8SortedAsUnicodeComparer) @@ -191,7 +191,7 @@ private OfflineSorter.ByteSequencesReader Sort() bool success = false; try { - byte[] buffer = Arrays.Empty(); + byte[] buffer = Array.Empty(); var output = new ByteArrayDataOutput(buffer); while (source.MoveNext()) @@ -327,4 +327,4 @@ protected internal virtual BytesRef DecodePayload(BytesRef scratch, ByteArrayDat return payloadScratch; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs b/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs index 3efb0ad06a..1ba9760d50 100644 --- a/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs +++ b/src/Lucene.Net.Suggest/Suggest/SortedTermFreqIteratorWrapper.cs @@ -1,6 +1,5 @@ using Lucene.Net.Search.Spell; using Lucene.Net.Store; -using Lucene.Net.Support; using Lucene.Net.Support.IO; using Lucene.Net.Util; using System; @@ -45,7 +44,7 @@ public class SortedTermFreqEnumeratorWrapper : ITermFreqEnumerator /// /// Creates a new sorted wrapper, using - /// for sorting. + /// for sorting. /// public SortedTermFreqEnumeratorWrapper(ITermFreqEnumerator source) : this(source, BytesRef.UTF8SortedAsUnicodeComparer) @@ -135,7 +134,7 @@ private OfflineSorter.ByteSequencesReader Sort() bool success = false; try { - byte[] buffer = Arrays.Empty(); + byte[] buffer = Array.Empty(); ByteArrayDataOutput output = new ByteArrayDataOutput(buffer); while (source.MoveNext()) @@ -203,4 +202,4 @@ protected internal virtual long Decode(BytesRef scratch, ByteArrayDataInput tmpI return tmpInput.ReadInt64(); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs index 68eda54952..47bb2a9531 100644 --- a/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs +++ b/src/Lucene.Net.TestFramework/Index/BaseDocValuesFormatTestCase.cs @@ -1526,7 +1526,7 @@ private static void DoTestBinaryVsStoredFields(int minLength, int maxLength) // { Document doc = new Document(); Field idField = new StringField("id", "", Field.Store.NO); - Field storedField = new StoredField("stored", Arrays.Empty()); + Field storedField = new StoredField("stored", Array.Empty()); Field dvField = new BinaryDocValuesField("dv", new BytesRef()); doc.Add(idField); doc.Add(storedField); @@ -1612,7 +1612,7 @@ private static void DoTestSortedVsStoredFields(int minLength, int maxLength) // { Document doc = new Document(); Field idField = new StringField("id", "", Field.Store.NO); - Field storedField = new StoredField("stored", Arrays.Empty()); + Field storedField = new StoredField("stored", Array.Empty()); Field dvField = new SortedDocValuesField("dv", new BytesRef()); doc.Add(idField); doc.Add(storedField); @@ -3064,7 +3064,7 @@ public virtual void TestHugeBinaryValues() for (int docID = 0; docID < docBytes.Count; docID++) { Document doc = ar.Document(docID); - + s.Get(docID, bytes); var expected = docBytes[Convert.ToInt32(doc.Get("id"), CultureInfo.InvariantCulture)]; Assert.AreEqual(expected.Length, bytes.Length); @@ -3197,7 +3197,7 @@ public virtual void TestThreads() { Document doc = new Document(); Field idField = new StringField("id", "", Field.Store.NO); - Field storedBinField = new StoredField("storedBin", Arrays.Empty()); + Field storedBinField = new StoredField("storedBin", Array.Empty()); Field dvBinField = new BinaryDocValuesField("dvBin", new BytesRef()); Field dvSortedField = new SortedDocValuesField("dvSorted", new BytesRef()); Field storedNumericField = new StoredField("storedNum", ""); @@ -3313,7 +3313,7 @@ public virtual void TestThreads2() using (RandomIndexWriter writer = new RandomIndexWriter(Random, dir, conf)) { Field idField = new StringField("id", "", Field.Store.NO); - Field storedBinField = new StoredField("storedBin", Arrays.Empty()); + Field storedBinField = new StoredField("storedBin", Array.Empty()); Field dvBinField = new BinaryDocValuesField("dvBin", new BytesRef()); Field dvSortedField = new SortedDocValuesField("dvSorted", new BytesRef()); Field storedNumericField = new StoredField("storedNum", ""); @@ -3544,4 +3544,4 @@ protected virtual bool CodecAcceptsHugeBinaryValues(string field) return true; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net.Tests/Search/Spans/TestSpans.cs b/src/Lucene.Net.Tests/Search/Spans/TestSpans.cs index 3d0f42820e..75da017501 100644 --- a/src/Lucene.Net.Tests/Search/Spans/TestSpans.cs +++ b/src/Lucene.Net.Tests/Search/Spans/TestSpans.cs @@ -5,6 +5,7 @@ using Lucene.Net.Support; using NUnit.Framework; using System.Collections.Generic; +using System; using Assert = Lucene.Net.TestFramework.Assert; namespace Lucene.Net.Search.Spans @@ -373,8 +374,8 @@ private void TstNextSpans(Spans spans, int doc, int start, int end) [Test] public virtual void TestSpanOrEmpty() { - // LUCENENET: Using Arrays.Empty() instead of new string[0] to reduce allocations - Spans spans = OrSpans(Arrays.Empty()); + // LUCENENET: Using Array.Empty() instead of new string[0] to reduce allocations + Spans spans = OrSpans(Array.Empty()); Assert.IsFalse(spans.MoveNext(), "empty next"); SpanOrQuery a = new SpanOrQuery(); diff --git a/src/Lucene.Net.Tests/Search/TestBoolean2.cs b/src/Lucene.Net.Tests/Search/TestBoolean2.cs index 864758692d..aff66d14f7 100644 --- a/src/Lucene.Net.Tests/Search/TestBoolean2.cs +++ b/src/Lucene.Net.Tests/Search/TestBoolean2.cs @@ -230,7 +230,7 @@ public virtual void TestQueries07() query.Add(new TermQuery(new Term(field, "w3")), Occur.MUST_NOT); query.Add(new TermQuery(new Term(field, "xx")), Occur.MUST_NOT); query.Add(new TermQuery(new Term(field, "w5")), Occur.MUST_NOT); - int[] expDocNrs = Arrays.Empty(); // LUCENENET: instead of new int[] { }; + int[] expDocNrs = Array.Empty(); // LUCENENET: instead of new int[] { }; QueriesTest(query, expDocNrs); } diff --git a/src/Lucene.Net.Tests/Util/TestArrayUtil.cs b/src/Lucene.Net.Tests/Util/TestArrayUtil.cs index 2fb9987efd..12945998b8 100644 --- a/src/Lucene.Net.Tests/Util/TestArrayUtil.cs +++ b/src/Lucene.Net.Tests/Util/TestArrayUtil.cs @@ -342,7 +342,7 @@ public virtual void TestTimSortStability() [Test] public virtual void TestEmptyArraySort() { - int[] a = Arrays.Empty(); + int[] a = Array.Empty(); ArrayUtil.IntroSort(a); ArrayUtil.TimSort(a); diff --git a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs index b945c2091e..3c343c79e5 100644 --- a/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs +++ b/src/Lucene.Net/Codecs/BlockTreeTermsReader.cs @@ -122,12 +122,12 @@ public class BlockTreeTermsReader : FieldsProducer /// to set state. It is *optional* and can be used when overriding the ReadHeader(), /// ReadIndexHeader() and SeekDir() methods. It only matters in the case where the state /// is required inside of any of those methods that is passed in to the subclass constructor. - /// + /// /// When passed to the constructor, it is set to the protected field m_subclassState before /// any of the above methods are called where it is available for reading when overriding the above methods. - /// + /// /// If your subclass needs to pass more than one piece of data, you can create a class or struct to do so. - /// All other virtual members of BlockTreeTermsReader are not called in the constructor, + /// All other virtual members of BlockTreeTermsReader are not called in the constructor, /// so the overrides of those methods won't specifically need to use this field (although they could for consistency). /// [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] @@ -1537,7 +1537,7 @@ internal sealed class SegmentTermsEnum : TermsEnum private FST.Arc[] arcs = new FST.Arc[1]; // LUCENENET specific - optimized empty array creation - private static readonly Frame[] EMPTY_FRAMES = Arrays.Empty(); + private static readonly Frame[] EMPTY_FRAMES = Array.Empty(); public SegmentTermsEnum(BlockTreeTermsReader.FieldReader outerInstance) { @@ -3461,4 +3461,4 @@ public override void CheckIntegrity() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs b/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs index 71a6da963b..bb39272ef8 100644 --- a/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs +++ b/src/Lucene.Net/Codecs/Compressing/CompressingStoredFieldsWriter.cs @@ -282,7 +282,7 @@ public override void WriteField(FieldInfo info, IIndexableField field) // LUCENENET specific - To avoid boxing/unboxing, we don't // call GetNumericValue(). Instead, we check the field.NumericType and then - // call the appropriate conversion method. + // call the appropriate conversion method. if (field.NumericType != NumericFieldType.NONE) { switch (field.NumericType) @@ -430,7 +430,7 @@ public override int Merge(MergeState mergeState) { // not all docs were deleted CompressingStoredFieldsReader.ChunkIterator it = matchingFieldsReader.GetChunkIterator(docID); - int[] startOffsets = Arrays.Empty(); + int[] startOffsets = Array.Empty(); do { // go to the next chunk that contains docID @@ -515,4 +515,4 @@ private static int NextDeletedDoc(int doc, IBits liveDocs, int maxDoc) return doc; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Codecs/PostingsFormat.cs b/src/Lucene.Net/Codecs/PostingsFormat.cs index 543c2050b7..ed54a7a322 100644 --- a/src/Lucene.Net/Codecs/PostingsFormat.cs +++ b/src/Lucene.Net/Codecs/PostingsFormat.cs @@ -37,25 +37,25 @@ namespace Lucene.Net.Codecs /// /// Subclass this class. /// Subclass , override , - /// and add the line base.ScanForPostingsFormats(typeof(YourPostingsFormat).Assembly). - /// If you have any format classes in your assembly - /// that are not meant for reading, you can add the + /// and add the line base.ScanForPostingsFormats(typeof(YourPostingsFormat).Assembly). + /// If you have any format classes in your assembly + /// that are not meant for reading, you can add the /// to them so they are ignored by the scan. - /// Set the new by calling + /// Set the new by calling /// at application startup. /// - /// If your format has dependencies, you may also override to inject + /// If your format has dependencies, you may also override to inject /// them via pure DI or a DI container. See DI-Friendly Framework /// to understand the approach used. /// /// PostingsFormat Names /// - /// Unlike the Java version, format names are by default convention-based on the class name. - /// If you name your custom format class "MyCustomPostingsFormat", the codec name will the same name + /// Unlike the Java version, format names are by default convention-based on the class name. + /// If you name your custom format class "MyCustomPostingsFormat", the codec name will the same name /// without the "PostingsFormat" suffix: "MyCustom". /// /// You can override this default behavior by using the to - /// name the format differently than this convention. Format names must be all ASCII alphanumeric, + /// name the format differently than this convention. Format names must be all ASCII alphanumeric, /// and less than 128 characters in length. /// /// @lucene.experimental @@ -74,7 +74,7 @@ public abstract class PostingsFormat //: NamedSPILoader.INamedSPI [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly PostingsFormat[] EMPTY = Arrays.Empty(); + public static readonly PostingsFormat[] EMPTY = Array.Empty(); /// /// Unique name that's used to retrieve this format when @@ -108,7 +108,7 @@ public static IPostingsFormatFactory GetPostingsFormatFactory() /// The provided name will be written into the index segment in some configurations /// (such as when using ): in such configurations, /// for the segment to be read this class should be registered by subclassing and - /// calling in the class constructor. + /// calling in the class constructor. /// The new can be registered by calling at application startup. protected PostingsFormat() { @@ -167,4 +167,4 @@ public static ICollection AvailablePostingsFormats // LUCENENET specific: Removed the ReloadPostingsFormats() method because // this goes against the grain of standard DI practices. } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Document/Document.cs b/src/Lucene.Net/Document/Document.cs index 247e06fd34..8c924029e4 100644 --- a/src/Lucene.Net/Document/Document.cs +++ b/src/Lucene.Net/Document/Document.cs @@ -36,7 +36,7 @@ namespace Lucene.Net.Documents /// it. /// /// Note that fields which are not are - /// not available in documents retrieved from the index, e.g. with + /// not available in documents retrieved from the index, e.g. with /// or . /// public sealed class Document : IEnumerable, IFormattable @@ -214,19 +214,19 @@ public IIndexableField[] GetFields(string name) /// Returns a List of all the fields in a document. /// Note that fields which are not stored are /// not available in documents retrieved from the - /// index, e.g. or + /// index, e.g. or /// . /// /// public IList Fields => fields; - private static readonly string[] NO_STRINGS = Arrays.Empty(); + private static readonly string[] NO_STRINGS = Array.Empty(); /// /// Returns an array of values of the field specified as the method parameter. /// This method returns an empty array when there are no /// matching fields. It never returns null. - /// For , , + /// For , , /// and it returns the string value of the number. If you want /// the actual numeric field instances back, use . /// the name of the field @@ -255,7 +255,7 @@ public string[] GetValues(string name) /// Returns an array of values of the field specified as the method parameter. /// This method returns an empty array when there are no /// matching fields. It never returns null. - /// For , , + /// For , , /// and it returns the string value of the number. If you want /// the actual numeric field instances back, use . /// the name of the field @@ -286,7 +286,7 @@ public string[] GetValues(string name, string format) /// Returns an array of values of the field specified as the method parameter. /// This method returns an empty array when there are no /// matching fields. It never returns null. - /// For , , + /// For , , /// and it returns the string value of the number. If you want /// the actual numeric field instances back, use . /// the name of the field @@ -317,7 +317,7 @@ public string[] GetValues(string name, IFormatProvider provider) /// Returns an array of values of the field specified as the method parameter. /// This method returns an empty array when there are no /// matching fields. It never returns null. - /// For , , + /// For , , /// and it returns the string value of the number. If you want /// the actual numeric field instances back, use . /// the name of the field @@ -350,7 +350,7 @@ public string[] GetValues(string name, string format, IFormatProvider provider) /// this document, or null. If multiple fields exist with this name, this /// method returns the first value added. If only binary fields with this name /// exist, returns null. - /// For , , + /// For , , /// and it returns the string value of the number. If you want /// the actual numeric field instance back, use . /// @@ -372,7 +372,7 @@ public string Get(string name) /// this document, or null. If multiple fields exist with this name, this /// method returns the first value added. If only binary fields with this name /// exist, returns null. - /// For , , + /// For , , /// and it returns the string value of the number. If you want /// the actual numeric field instance back, use . /// @@ -396,7 +396,7 @@ public string Get(string name, string format) /// this document, or null. If multiple fields exist with this name, this /// method returns the first value added. If only binary fields with this name /// exist, returns null. - /// For , , + /// For , , /// and it returns the string value of the number. If you want /// the actual numeric field instance back, use . /// @@ -420,7 +420,7 @@ public string Get(string name, IFormatProvider provider) /// this document, or null. If multiple fields exist with this name, this /// method returns the first value added. If only binary fields with this name /// exist, returns null. - /// For , , + /// For , , /// and it returns the string value of the number. If you want /// the actual numeric field instance back, use . /// @@ -448,7 +448,7 @@ public override string ToString() } /// - /// Prints the fields of a document for human consumption. + /// Prints the fields of a document for human consumption. /// /// An object that supplies culture-specific formatting information. This parameter has no effect if this field is non-numeric. // LUCENENET specific - method added for better .NET compatibility @@ -458,7 +458,7 @@ public string ToString(IFormatProvider provider) } /// - /// Prints the fields of a document for human consumption. + /// Prints the fields of a document for human consumption. /// /// A standard or custom numeric format string. This parameter has no effect if this field is non-numeric. /// An object that supplies culture-specific formatting information. This parameter has no effect if this field is non-numeric. @@ -488,7 +488,7 @@ private string ToString(string format, IFormatProvider provider) } /// - /// Prints the fields of a document for human consumption. + /// Prints the fields of a document for human consumption. /// /// A standard or custom numeric format string. This parameter has no effect if this field is non-numeric. /// An object that supplies culture-specific formatting information. This parameter has no effect if this field is non-numeric. @@ -498,4 +498,4 @@ string IFormattable.ToString(string format, IFormatProvider provider) return ToString(format, provider); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/Fields.cs b/src/Lucene.Net/Index/Fields.cs index b89d45c2a8..1ec98652e6 100644 --- a/src/Lucene.Net/Index/Fields.cs +++ b/src/Lucene.Net/Index/Fields.cs @@ -69,7 +69,7 @@ IEnumerator IEnumerable.GetEnumerator() /// Returns the number of terms for all fields, or -1 if this /// measure isn't stored by the codec. Note that, just like /// other term measures, this measure does not take deleted - /// documents into account. + /// documents into account. /// /// [Obsolete("Iterate fields and add their Count instead. This method is only provided as a transition mechanism to access this statistic for 3.x indexes, which do not have this statistic per-field.")] @@ -102,6 +102,6 @@ public virtual long UniqueTermCount [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly Fields[] EMPTY_ARRAY = Arrays.Empty(); + public static readonly Fields[] EMPTY_ARRAY = Array.Empty(); } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/IndexFileDeleter.cs b/src/Lucene.Net/Index/IndexFileDeleter.cs index 8883f4779b..85b7a8eeea 100644 --- a/src/Lucene.Net/Index/IndexFileDeleter.cs +++ b/src/Lucene.Net/Index/IndexFileDeleter.cs @@ -156,7 +156,7 @@ public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, Segment catch (Exception e) when (e.IsNoSuchDirectoryException()) { // it means the directory is empty, so ignore it. - files = Arrays.Empty(); + files = Array.Empty(); } if (currentSegmentsFile != null) @@ -803,4 +803,4 @@ public override void Delete() public override bool IsDeleted => deleted; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/MultiTermsEnum.cs b/src/Lucene.Net/Index/MultiTermsEnum.cs index 3b8d20a28d..f53dbbe0e8 100644 --- a/src/Lucene.Net/Index/MultiTermsEnum.cs +++ b/src/Lucene.Net/Index/MultiTermsEnum.cs @@ -55,7 +55,7 @@ public class TermsEnumIndex [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly TermsEnumIndex[] EMPTY_ARRAY = Arrays.Empty(); + public static readonly TermsEnumIndex[] EMPTY_ARRAY = Array.Empty(); internal int SubIndex { get; private set; } internal TermsEnum TermsEnum { get; private set; } @@ -67,8 +67,8 @@ public TermsEnumIndex(TermsEnum termsEnum, int subIndex) } /// - /// Returns how many sub-reader slices contain the current - /// term. + /// Returns how many sub-reader slices contain the current + /// term. /// public int MatchCount => numTop; @@ -640,4 +640,4 @@ public override string ToString() return "MultiTermsEnum(" + Arrays.ToString(subs) + ")"; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/ParallelCompositeReader.cs b/src/Lucene.Net/Index/ParallelCompositeReader.cs index 4457a87619..e50fed2438 100644 --- a/src/Lucene.Net/Index/ParallelCompositeReader.cs +++ b/src/Lucene.Net/Index/ParallelCompositeReader.cs @@ -106,7 +106,7 @@ private static IndexReader[] PrepareSubReaders(CompositeReader[] readers, Compos throw new ArgumentException("There must be at least one main reader if storedFieldsReaders are used."); } // LUCENENET: Optimized empty string array creation - return Arrays.Empty(); + return Array.Empty(); } else { @@ -262,4 +262,4 @@ protected internal override void DoClose() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/ReaderSlice.cs b/src/Lucene.Net/Index/ReaderSlice.cs index 5b0825f2e6..95959cd708 100644 --- a/src/Lucene.Net/Index/ReaderSlice.cs +++ b/src/Lucene.Net/Index/ReaderSlice.cs @@ -1,5 +1,5 @@ -using Lucene.Net.Support; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; +using System; namespace Lucene.Net.Index { @@ -32,7 +32,7 @@ public sealed class ReaderSlice [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly ReaderSlice[] EMPTY_ARRAY = Arrays.Empty(); + public static readonly ReaderSlice[] EMPTY_ARRAY = Array.Empty(); /// /// Document ID this slice starts from. @@ -60,4 +60,4 @@ public override string ToString() return "slice start=" + Start + " length=" + Length + " readerIndex=" + ReaderIndex; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Index/Terms.cs b/src/Lucene.Net/Index/Terms.cs index fa6d76a2f7..e3241d8793 100644 --- a/src/Lucene.Net/Index/Terms.cs +++ b/src/Lucene.Net/Index/Terms.cs @@ -68,7 +68,7 @@ protected Terms() /// /// Returns a that iterates over all terms that - /// are accepted by the provided + /// are accepted by the provided /// . If the is /// provided then the returned enum will only accept terms /// > , but you still must call @@ -144,7 +144,7 @@ protected override BytesRef NextSeekTerm(BytesRef term) /// measures, this measure does not take deleted documents /// into account. /// - public abstract long SumTotalTermFreq { get; } + public abstract long SumTotalTermFreq { get; } /// /// Returns the sum of for @@ -187,6 +187,6 @@ protected override BytesRef NextSeekTerm(BytesRef term) [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly Terms[] EMPTY_ARRAY = Arrays.Empty(); + public static readonly Terms[] EMPTY_ARRAY = Array.Empty(); } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/CachingCollector.cs b/src/Lucene.Net/Search/CachingCollector.cs index f128718d61..9c5d6b3d3f 100644 --- a/src/Lucene.Net/Search/CachingCollector.cs +++ b/src/Lucene.Net/Search/CachingCollector.cs @@ -58,7 +58,7 @@ public abstract class CachingCollector : ICollector /// /// NOTE: This was EMPTY_INT_ARRAY in Lucene /// - private static readonly int[] EMPTY_INT32_ARRAY = Arrays.Empty(); + private static readonly int[] EMPTY_INT32_ARRAY = Array.Empty(); private class SegStart { @@ -542,4 +542,4 @@ internal virtual void ReplayInit(ICollector other) /// while the collector passed to the ctor does. public abstract void Replay(ICollector other); } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/FieldComparator.cs b/src/Lucene.Net/Search/FieldComparator.cs index 11a7078292..847043a85b 100644 --- a/src/Lucene.Net/Search/FieldComparator.cs +++ b/src/Lucene.Net/Search/FieldComparator.cs @@ -37,10 +37,10 @@ namespace Lucene.Net.Search /// classes here correspond to the types. /// /// This API is designed to achieve high performance - /// sorting, by exposing a tight interaction with + /// sorting, by exposing a tight interaction with /// as it visits hits. Whenever a hit is /// competitive, it's enrolled into a virtual slot, which is - /// an ranging from 0 to numHits-1. The + /// an ranging from 0 to numHits-1. The /// is made aware of segment transitions /// during searching in case any internal state it's tracking /// needs to be recomputed during these transitions. @@ -113,7 +113,7 @@ public abstract class FieldComparer : FieldComparer public abstract override void SetBottom(int slot); /// - /// Record the top value, for future calls to + /// Record the top value, for future calls to /// . This is only called for searches that /// use SearchAfter (deep paging), and is called before any /// calls to . @@ -132,7 +132,7 @@ public override void SetTopValue(TValue value) where TValue : class } /// - /// Record the top value, for future calls to + /// Record the top value, for future calls to /// . This is only called for searches that /// use SearchAfter (deep paging), and is called before any /// calls to . @@ -153,7 +153,7 @@ public override void SetTopValue(TValue value) where TValue : class /// /// Compare the bottom of the queue with this doc. This will /// only invoked after has been called. This - /// should return the same result as + /// should return the same result as /// as if bottom were slot1 and the new /// document were slot 2. /// @@ -171,7 +171,7 @@ public override void SetTopValue(TValue value) where TValue : class /// /// Compare the top value with this doc. This will /// only invoked after has been called. This - /// should return the same result as + /// should return the same result as /// as if topValue were slot1 and the new /// document were slot 2. This is only called for searches that /// use SearchAfter (deep paging). @@ -284,7 +284,7 @@ internal FieldComparer() { } public abstract void SetBottom(int slot); /// - /// Record the top value, for future calls to + /// Record the top value, for future calls to /// . This is only called for searches that /// use SearchAfter (deep paging), and is called before any /// calls to . @@ -294,7 +294,7 @@ internal FieldComparer() { } /// /// Compare the bottom of the queue with this doc. This will /// only invoked after setBottom has been called. This - /// should return the same result as + /// should return the same result as /// as if bottom were slot1 and the new /// document were slot 2. /// @@ -312,7 +312,7 @@ internal FieldComparer() { } /// /// Compare the top value with this doc. This will /// only invoked after has been called. This - /// should return the same result as + /// should return the same result as /// as if topValue were slot1 and the new /// document were slot 2. This is only called for searches that /// use SearchAfter (deep paging). @@ -402,7 +402,7 @@ public override FieldComparer SetNextReader(AtomicReaderContext context) } /// - /// Parses field's values as (using + /// Parses field's values as (using /// and sorts by ascending value /// [Obsolete, CLSCompliant(false)] // LUCENENET NOTE: marking non-CLS compliant because of sbyte - it is obsolete, anyway @@ -487,7 +487,7 @@ public override int CompareTop(int doc) } /// - /// Parses field's values as (using + /// Parses field's values as (using /// and sorts by ascending value /// public sealed class DoubleComparer : NumericComparer @@ -580,7 +580,7 @@ public override int CompareTop(int doc) } /// - /// Parses field's values as (using + /// Parses field's values as (using /// and sorts by ascending value /// /// NOTE: This was FloatComparator in Lucene @@ -676,7 +676,7 @@ public override int CompareTop(int doc) } /// - /// Parses field's values as (using + /// Parses field's values as (using /// and sorts by ascending value /// /// NOTE: This was ShortComparator in Lucene @@ -738,7 +738,7 @@ public override FieldComparer SetNextReader(AtomicReaderContext context) return base.SetNextReader(context); } - public override void SetBottom(int slot) + public override void SetBottom(int slot) { bottom = values[slot]; } @@ -764,7 +764,7 @@ public override int CompareTop(int doc) } /// - /// Parses field's values as (using + /// Parses field's values as (using /// and sorts by ascending value /// /// NOTE: This was IntComparator in Lucene @@ -1106,7 +1106,7 @@ public override int CompareTop(int doc) /// /// Sorts by field's natural sort order, using - /// ordinals. This is functionally equivalent to + /// ordinals. This is functionally equivalent to /// , but it first resolves the string /// to their relative ordinal positions (using the index /// returned by ), and diff --git a/src/Lucene.Net/Search/TopDocs.cs b/src/Lucene.Net/Search/TopDocs.cs index 297dfbbd40..26bcd34104 100644 --- a/src/Lucene.Net/Search/TopDocs.cs +++ b/src/Lucene.Net/Search/TopDocs.cs @@ -28,8 +28,8 @@ namespace Lucene.Net.Search */ /// - /// Represents hits returned by - /// and + /// Represents hits returned by + /// and /// . /// public class TopDocs @@ -287,7 +287,7 @@ protected internal override bool LessThan(Shard first, Shard second) /// /// Returns a new , containing results across - /// the provided , sorting by the specified + /// the provided , sorting by the specified /// . Each of the must have been sorted by /// the same , and sort field values must have been /// filled (ie, fillFields=true must be @@ -307,7 +307,7 @@ public static TopDocs Merge(Sort? sort, int topN, TopDocs[] shardHits) /// /// Same as but also slices the result at the same time based - /// on the provided start and size. The return TopDocs will always have a scoreDocs with length of + /// on the provided start and size. The return TopDocs will always have a scoreDocs with length of /// at most . /// /// is null. @@ -365,7 +365,7 @@ public static TopDocs Merge(Sort? sort, int start, int size, TopDocs[] shardHits ScoreDoc[] hits; if (availHitCount <= start) { - hits = Arrays.Empty(); + hits = Array.Empty(); } else { @@ -416,4 +416,4 @@ public static TopDocs Merge(Sort? sort, int start, int size, TopDocs[] shardHits } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/TopDocsCollector.cs b/src/Lucene.Net/Search/TopDocsCollector.cs index f0101c0068..df9e719429 100644 --- a/src/Lucene.Net/Search/TopDocsCollector.cs +++ b/src/Lucene.Net/Search/TopDocsCollector.cs @@ -1,4 +1,4 @@ -using Lucene.Net.Index; +using Lucene.Net.Index; using Lucene.Net.Support; using Lucene.Net.Util; using System; @@ -40,7 +40,7 @@ public abstract class TopDocsCollector : ICollector, ITopDocsCollector where /// This is used in case is called with illegal parameters, or there /// simply aren't (enough) results. /// - protected static readonly TopDocs EMPTY_TOPDOCS = new TopDocs(0, Arrays.Empty(), float.NaN); + protected static readonly TopDocs EMPTY_TOPDOCS = new TopDocs(0, Array.Empty(), float.NaN); /// /// The priority queue which holds the top documents. Note that different @@ -94,7 +94,7 @@ public virtual int TotalHits } /// - /// The number of valid priority queue entries + /// The number of valid priority queue entries /// protected virtual int TopDocsCount => // In case pq was populated with sentinel values, there might be less @@ -228,7 +228,7 @@ public virtual TopDocs GetTopDocs(int start, int howMany) /// /// Most Lucene Query implementations will visit /// matching docIDs in order. However, some queries - /// (currently limited to certain cases of ) + /// (currently limited to certain cases of ) /// can achieve faster searching if the /// allows them to deliver the /// docIDs out of order. @@ -289,4 +289,4 @@ public interface ITopDocsCollector : ICollector /// TopDocs GetTopDocs(int start, int howMany); } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/TopFieldCollector.cs b/src/Lucene.Net/Search/TopFieldCollector.cs index c666fca372..ac6239aa64 100644 --- a/src/Lucene.Net/Search/TopFieldCollector.cs +++ b/src/Lucene.Net/Search/TopFieldCollector.cs @@ -104,7 +104,7 @@ public override void SetNextReader(AtomicReaderContext context) queue.SetComparer(0, comparer.SetNextReader(context)); comparer = queue.FirstComparer; } - + public override void SetScorer(Scorer scorer) { comparer.SetScorer(scorer); @@ -1134,7 +1134,7 @@ public override void SetNextReader(AtomicReaderContext context) } } - private static readonly ScoreDoc[] EMPTY_SCOREDOCS = Arrays.Empty(); + private static readonly ScoreDoc[] EMPTY_SCOREDOCS = Array.Empty(); private readonly bool fillFields; @@ -1395,4 +1395,4 @@ protected override TopDocs NewTopDocs(ScoreDoc[]? results, int start) public override bool AcceptsDocsOutOfOrder => false; } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Search/TopScoreDocCollector.cs b/src/Lucene.Net/Search/TopScoreDocCollector.cs index a0ee5149e8..7e729f92be 100644 --- a/src/Lucene.Net/Search/TopScoreDocCollector.cs +++ b/src/Lucene.Net/Search/TopScoreDocCollector.cs @@ -143,7 +143,7 @@ public override void SetNextReader(AtomicReaderContext context) protected override TopDocs NewTopDocs(ScoreDoc[] results, int start) { // LUCENENET specific - optimized empty array creation - return results is null ? new TopDocs(m_totalHits, Arrays.Empty(), float.NaN) : new TopDocs(m_totalHits, results); + return results is null ? new TopDocs(m_totalHits, Array.Empty(), float.NaN) : new TopDocs(m_totalHits, results); } } @@ -254,7 +254,7 @@ public override void SetNextReader(AtomicReaderContext context) protected override TopDocs NewTopDocs(ScoreDoc[] results, int start) { // LUCENENET specific - optimized empty array creation - return results is null ? new TopDocs(m_totalHits, Arrays.Empty(), float.NaN) : new TopDocs(m_totalHits, results); + return results is null ? new TopDocs(m_totalHits, Array.Empty(), float.NaN) : new TopDocs(m_totalHits, results); } } @@ -358,4 +358,4 @@ public override void SetScorer(Scorer scorer) this.scorer = scorer; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Support/Arrays.cs b/src/Lucene.Net/Support/Arrays.cs index d8ddb48b8a..3fdc0f2b57 100644 --- a/src/Lucene.Net/Support/Arrays.cs +++ b/src/Lucene.Net/Support/Arrays.cs @@ -651,31 +651,5 @@ public static string ToString(T[] array, IFormatProvider provider) sb.Append(']'); return sb.ToString(); } - - /// - /// Returns an empty array. - /// - /// The type of the elements of the array. - /// An empty array. - // LUCENENET: Since Array.Empty() doesn't exist in all supported platforms, we - // have this wrapper method to add support. - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static T[] Empty() - { -#if FEATURE_ARRAYEMPTY - return Array.Empty(); -#else - return EmptyArrayHolder.EMPTY; -#endif - } - -#if !FEATURE_ARRAYEMPTY - private static class EmptyArrayHolder - { -#pragma warning disable CA1825 // Avoid zero-length array allocations. - public static readonly T[] EMPTY = new T[0]; -#pragma warning restore CA1825 // Avoid zero-length array allocations. - } -#endif } } diff --git a/src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs b/src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs index 2a983016fe..b3ec75e560 100644 --- a/src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs +++ b/src/Lucene.Net/Util/Automaton/DaciukMihovAutomatonBuilder.cs @@ -1,4 +1,4 @@ -using J2N; +using J2N; using J2N.Runtime.CompilerServices; using J2N.Text; using Lucene.Net.Diagnostics; @@ -43,11 +43,11 @@ public sealed class State // LUCENENET NOTE: Made public because it is returned { /// /// An empty set of labels. - private static readonly int[] NO_LABELS = Arrays.Empty(); + private static readonly int[] NO_LABELS = Array.Empty(); /// /// An empty set of states. - private static readonly State[] NO_STATES = Arrays.Empty(); + private static readonly State[] NO_STATES = Array.Empty(); /// /// Labels of outgoing transitions. Indexed identically to . @@ -382,4 +382,4 @@ private static void AddSuffix(State state, ICharSequence current, int fromIndex) state.is_final = true; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/Automaton/State.cs b/src/Lucene.Net/Util/Automaton/State.cs index a80301a3c5..898bdff630 100644 --- a/src/Lucene.Net/Util/Automaton/State.cs +++ b/src/Lucene.Net/Util/Automaton/State.cs @@ -51,7 +51,7 @@ public class State : IComparable public Transition[] TransitionsArray => transitionsArray; // LUCENENET NOTE: Setter removed because it is apparently not in use outside of this class - private Transition[] transitionsArray = Arrays.Empty(); + private Transition[] transitionsArray = Array.Empty(); internal int numTransitions = 0;// LUCENENET NOTE: Made internal because we already have a public property for access @@ -74,7 +74,7 @@ public State() /// internal void ResetTransitions() { - transitionsArray = Arrays.Empty(); + transitionsArray = Array.Empty(); numTransitions = 0; } @@ -220,7 +220,7 @@ public virtual void Step(int c, ICollection dest) /// /// Virtually adds an epsilon transition to the target /// state. this is implemented by copying all - /// transitions from to this state, and if + /// transitions from to this state, and if /// is an accept state then set accept for this state. /// [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -373,4 +373,4 @@ public override int GetHashCode() return id; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/Bits.cs b/src/Lucene.Net/Util/Bits.cs index d7d34ddc29..e04a05c05b 100644 --- a/src/Lucene.Net/Util/Bits.cs +++ b/src/Lucene.Net/Util/Bits.cs @@ -1,6 +1,6 @@ -using Lucene.Net.Support; -using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; +using System; namespace Lucene.Net.Util { @@ -47,7 +47,7 @@ public static class Bits [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly IBits[] EMPTY_ARRAY = Arrays.Empty(); + public static readonly IBits[] EMPTY_ARRAY = Array.Empty(); /// /// Bits impl of the specified length with all bits set. @@ -91,4 +91,4 @@ public bool Get(int index) public int Length => _len; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/BytesRef.cs b/src/Lucene.Net/Util/BytesRef.cs index de0b66d4fd..b381f31eb8 100644 --- a/src/Lucene.Net/Util/BytesRef.cs +++ b/src/Lucene.Net/Util/BytesRef.cs @@ -52,7 +52,7 @@ namespace Lucene.Net.Util [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly byte[] EMPTY_BYTES = Arrays.Empty(); + public static readonly byte[] EMPTY_BYTES = Array.Empty(); /// /// The contents of the BytesRef. Should never be null. @@ -206,7 +206,7 @@ public object Clone() /// /// Calculates the hash code as required by during indexing. /// This is currently implemented as MurmurHash3 (32 - /// bit), using the seed from + /// bit), using the seed from /// , but is subject to /// change from release to release. /// @@ -402,7 +402,7 @@ public bool IsValid() } } - // LUCENENET: It is no longer good practice to use binary serialization. + // LUCENENET: It is no longer good practice to use binary serialization. // See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568 #if FEATURE_SERIALIZABLE [Serializable] @@ -443,7 +443,7 @@ public virtual int Compare(BytesRef a, BytesRef b) /// @deprecated this comparer is only a transition mechanism [Obsolete("this comparer is only a transition mechanism")] - // LUCENENET: It is no longer good practice to use binary serialization. + // LUCENENET: It is no longer good practice to use binary serialization. // See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568 #if FEATURE_SERIALIZABLE [Serializable] @@ -516,7 +516,7 @@ internal enum BytesRefFormat // For assert/test/logging UTF8AsHex } - // LUCENENET specific - when this object is a parameter of + // LUCENENET specific - when this object is a parameter of // a method that calls string.Format(), // defers execution of building a string until // string.Format() is called. @@ -557,4 +557,4 @@ public override string ToString() } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/CharsRef.cs b/src/Lucene.Net/Util/CharsRef.cs index 8b10a485b7..4ab00fe4fd 100644 --- a/src/Lucene.Net/Util/CharsRef.cs +++ b/src/Lucene.Net/Util/CharsRef.cs @@ -44,7 +44,7 @@ public sealed class CharsRef : IComparable, ICharSequence, IEquatable< [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly char[] EMPTY_CHARS = Arrays.Empty(); + public static readonly char[] EMPTY_CHARS = Array.Empty(); bool ICharSequence.HasValue => true; @@ -86,7 +86,7 @@ public CharsRef(int capacity) } /// - /// Creates a new initialized with the given , + /// Creates a new initialized with the given , /// and . /// public CharsRef(char[] chars, int offset, int length) @@ -326,7 +326,7 @@ public ICharSequence Subsequence(int startIndex, int length) /// @deprecated this comparer is only a transition mechanism [Obsolete("this comparer is only a transition mechanism")] - // LUCENENET: It is no longer good practice to use binary serialization. + // LUCENENET: It is no longer good practice to use binary serialization. // See: https://github.com/dotnet/corefx/issues/23584#issuecomment-325724568 #if FEATURE_SERIALIZABLE [Serializable] @@ -444,4 +444,4 @@ public bool IsValid() return true; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/FieldCacheSanityChecker.cs b/src/Lucene.Net/Util/FieldCacheSanityChecker.cs index 6e781e1069..6253f8cd51 100644 --- a/src/Lucene.Net/Util/FieldCacheSanityChecker.cs +++ b/src/Lucene.Net/Util/FieldCacheSanityChecker.cs @@ -46,7 +46,7 @@ namespace Lucene.Net.Util /// Unit tests) to check at run time if the FieldCache contains "insane" /// usages of the FieldCache. /// - /// @lucene.experimental + /// @lucene.experimental /// /// /// @@ -107,7 +107,7 @@ public Insanity[] Check(params FieldCache.CacheEntry[] cacheEntries) { if (null == cacheEntries || 0 == cacheEntries.Length) { - return Arrays.Empty(); + return Array.Empty(); } if (estimateRam) @@ -354,7 +354,7 @@ public override bool Equals(object that) } ReaderField other = (ReaderField)that; - return (object.ReferenceEquals(this.readerKey, other.readerKey) + return (object.ReferenceEquals(this.readerKey, other.readerKey) && this.FieldName.Equals(other.FieldName, StringComparison.Ordinal)); } @@ -484,4 +484,4 @@ public override string ToString() public static readonly InsanityType EXPECTED = new InsanityType("EXPECTED"); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/Fst/FST.cs b/src/Lucene.Net/Util/Fst/FST.cs index 4197a4bb15..2b9661d0ed 100644 --- a/src/Lucene.Net/Util/Fst/FST.cs +++ b/src/Lucene.Net/Util/Fst/FST.cs @@ -110,7 +110,7 @@ public enum INPUT_TYPE /// internal const int FIXED_ARRAY_NUM_ARCS_DEEP = 10;*/ - private int[] bytesPerArc = Arrays.Empty(); + private int[] bytesPerArc = Array.Empty(); /*// Increment version to change it private const string FILE_FORMAT_NAME = "FST"; @@ -227,7 +227,7 @@ internal FST(FST.INPUT_TYPE inputType, Outputs outputs, bool willPackFST, flo nodeRefToAddress = null; } - + /// /// Load a previously saved FST. @@ -447,7 +447,7 @@ private bool AssertRootArcs() // LUCENENET NOTE: In .NET, IEnumerable will not equal another identical IEnumerable // because it checks for reference equality, not that the list contents // are the same. StructuralEqualityComparer.Default.Equals() will make that check. - Debugging.Assert(typeof(T).IsValueType + Debugging.Assert(typeof(T).IsValueType ? JCG.EqualityComparer.Default.Equals(root.NextFinalOutput, asserting.NextFinalOutput) : StructuralEqualityComparer.Default.Equals(root.NextFinalOutput, asserting.NextFinalOutput)); Debugging.Assert(root.Node == asserting.Node); @@ -2408,4 +2408,4 @@ protected internal override bool LessThan(NodeAndInCount? a, NodeAndInCount? b) } } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/IntsRef.cs b/src/Lucene.Net/Util/IntsRef.cs index 01af240bbe..ef90b03e47 100644 --- a/src/Lucene.Net/Util/IntsRef.cs +++ b/src/Lucene.Net/Util/IntsRef.cs @@ -46,10 +46,10 @@ public sealed class Int32sRef : IComparable // LUCENENET specific: No [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly int[] EMPTY_INT32S = Arrays.Empty(); + public static readonly int[] EMPTY_INT32S = Array.Empty(); /// - /// The contents of the . Should never be null. + /// The contents of the . Should never be null. /// /// NOTE: This was ints (field) in Lucene /// @@ -294,4 +294,4 @@ public bool IsValid() return true; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/LongsRef.cs b/src/Lucene.Net/Util/LongsRef.cs index b90b27500f..b111bbbfd2 100644 --- a/src/Lucene.Net/Util/LongsRef.cs +++ b/src/Lucene.Net/Util/LongsRef.cs @@ -47,10 +47,10 @@ public sealed class Int64sRef : IComparable // LUCENENET specific: No [SuppressMessage("CodeQuality", "IDE0079:Remove unnecessary suppression", Justification = "This is a SonarCloud issue")] [SuppressMessage("Performance", "S3887:Use an immutable collection or reduce the accessibility of the non-private readonly field", Justification = "Collection is immutable")] [SuppressMessage("Performance", "S2386:Use an immutable collection or reduce the accessibility of the public static field", Justification = "Collection is immutable")] - public static readonly long[] EMPTY_INT64S = Arrays.Empty(); + public static readonly long[] EMPTY_INT64S = Array.Empty(); /// - /// The contents of the . Should never be null. + /// The contents of the . Should never be null. /// /// NOTE: This was longs (field) in Lucene /// @@ -294,4 +294,4 @@ public bool IsValid() return true; } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/PagedBytes.cs b/src/Lucene.Net/Util/PagedBytes.cs index 0a1bd9c196..6a736f5e94 100644 --- a/src/Lucene.Net/Util/PagedBytes.cs +++ b/src/Lucene.Net/Util/PagedBytes.cs @@ -54,7 +54,7 @@ public sealed class PagedBytes private byte[] currentBlock; private readonly long bytesUsedPerBlock; - private static readonly byte[] EMPTY_BYTES = Arrays.Empty(); + private static readonly byte[] EMPTY_BYTES = Array.Empty(); /// /// Provides methods to read s from a frozen @@ -523,4 +523,4 @@ public PagedBytesDataOutput GetDataOutput() return new PagedBytesDataOutput(this); } } -} \ No newline at end of file +} diff --git a/src/Lucene.Net/Util/WAH8DocIdSet.cs b/src/Lucene.Net/Util/WAH8DocIdSet.cs index acbabd3457..04def589a5 100644 --- a/src/Lucene.Net/Util/WAH8DocIdSet.cs +++ b/src/Lucene.Net/Util/WAH8DocIdSet.cs @@ -91,7 +91,7 @@ public sealed class WAH8DocIdSet : DocIdSet private static readonly MonotonicAppendingInt64Buffer SINGLE_ZERO_BUFFER = LoadSingleZeroBuffer(); // LUCENENET specific - optimized empty array creation - private static readonly WAH8DocIdSet EMPTY = new WAH8DocIdSet(Arrays.Empty(), 0, 1, SINGLE_ZERO_BUFFER, SINGLE_ZERO_BUFFER); + private static readonly WAH8DocIdSet EMPTY = new WAH8DocIdSet(Array.Empty(), 0, 1, SINGLE_ZERO_BUFFER, SINGLE_ZERO_BUFFER); [MethodImpl(MethodImplOptions.AggressiveInlining)] private static MonotonicAppendingInt64Buffer LoadSingleZeroBuffer() // LUCENENET: Avoid static constructors (see https://github.com/apache/lucenenet/pull/224#issuecomment-469284006) { @@ -934,4 +934,4 @@ public long RamBytesUsed() + wordNums.RamBytesUsed(); } } -} \ No newline at end of file +} diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs index 05692d0e0c..58f2febac3 100644 --- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs +++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexFixCommandTest.cs @@ -1,7 +1,7 @@ using Lucene.Net.Attributes; using Lucene.Net.Cli.CommandLine; -using Lucene.Net.Support; using NUnit.Framework; +using System; using System.Collections.Generic; using System.Linq; @@ -38,7 +38,7 @@ protected override IList GetOptionalArgs() { new Arg[] { new Arg(inputPattern: "", output: new string[] { "-fix" }), - new Arg(inputPattern: "--dry-run", output: Arrays.Empty()), + new Arg(inputPattern: "--dry-run", output: Array.Empty()), }, new Arg[] { new Arg(inputPattern: "-c|--cross-check-term-vectors", output: new string[] { "-crossCheckTermVectors" }) }, new Arg[] { new Arg(inputPattern: "-v|--verbose", output: new string[] { "-verbose" }) }, @@ -78,7 +78,7 @@ public override void TestAllValidCombinations() string command = string.Join(" ", requiredArg.Select(x => x.InputPattern).Union(optionalArg.Select(x => x.InputPattern).ToArray())); string[] expected = requiredArg.SelectMany(x => x.Output) // Special case: the -fix option must be specified when --dry-run is not - .Concat(command.Contains("--dry-run") ? Arrays.Empty() : new string[] { "-fix" }) + .Concat(command.Contains("--dry-run") ? Array.Empty() : new string[] { "-fix" }) .Union(optionalArg.SelectMany(x => x.Output)).ToArray(); AssertCommandTranslation(command, expected); } diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexSplitCommandTest.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexSplitCommandTest.cs index f8146e9446..2a0c1def88 100644 --- a/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexSplitCommandTest.cs +++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/Commands/Index/IndexSplitCommandTest.cs @@ -1,6 +1,6 @@ using Lucene.Net.Attributes; -using Lucene.Net.Support; using NUnit.Framework; +using System; using System.Collections.Generic; using System.Linq; @@ -45,7 +45,7 @@ protected override IList GetRequiredArgs() // NOTE: We must order this in the sequence of the expected output. return new List() { - new Arg[] { new Arg(inputPattern: @"C:\lucene-temp", output: Arrays.Empty() /*"-out", @"C:\lucene-temp"*/) }, + new Arg[] { new Arg(inputPattern: @"C:\lucene-temp", output: Array.Empty() /*"-out", @"C:\lucene-temp"*/) }, new Arg[] { new Arg(inputPattern: @"C:\lucene-temp2 C:\lucene-temp3", output: new string[] { @"C:\lucene-temp2", @"C:\lucene-temp3" }), new Arg(inputPattern: @"C:\lucene-temp2 C:\lucene-temp3 C:\lucene-temp4", output: new string[] { @"C:\lucene-temp2", @"C:\lucene-temp3", @"C:\lucene-temp4" }), @@ -82,7 +82,7 @@ public override void TestAllValidCombinations() // Special case: the -num option must be specified when -n is not // because in MultiPassIndexSplitter it is not optional, so we are patching // it in our command to make 2 the default. - .Concat(command.Contains("-n") ? Arrays.Empty() : new string[] { "-num", "2" }) + .Concat(command.Contains("-n") ? Array.Empty() : new string[] { "-num", "2" }) .Union(optionalArg.SelectMany(x => x.Output)).ToArray(); AssertCommandTranslation(command, expected); }