diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs index a4b388a837..09e3ad5c2a 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Hunspell/Dictionary.cs @@ -290,7 +290,8 @@ private void ReadAffixFile(Stream affixStream, Encoding decoder) patterns.Add(null); // zero strip -> 0 ord - IDictionary seenStrips = new JCG.LinkedDictionary + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + IDictionary seenStrips = new JCG.OrderedDictionary { [""] = 0 }; diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PerFieldAnalyzerWrapper.cs b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PerFieldAnalyzerWrapper.cs index b92324c240..2d482c5a90 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PerFieldAnalyzerWrapper.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Miscellaneous/PerFieldAnalyzerWrapper.cs @@ -85,7 +85,7 @@ public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer) /// Use when sorted keys are required. null keys are supported. /// /// - /// + /// /// Use when insertion order must be preserved ( preserves insertion /// order only until items are removed). null keys are supported. /// diff --git a/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs b/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs index 77cb257d73..48e93a734a 100644 --- a/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs +++ b/src/Lucene.Net.Analysis.Common/Analysis/Util/AnalysisSPILoader.cs @@ -63,7 +63,8 @@ public void Reload() UninterruptableMonitor.Enter(this); try { - IDictionary services = new JCG.LinkedDictionary(this.services); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + IDictionary services = new JCG.OrderedDictionary(this.services); SPIClassIterator loader = SPIClassIterator.Get(); foreach (var service in loader) diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs index 97eafd7c85..e275403207 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameRoundTask.cs @@ -55,7 +55,8 @@ public override int DoLogic() protected virtual Report ReportSumByNameRound(IList taskStats) { // aggregate by task name and round - JCG.LinkedDictionary p2 = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + JCG.OrderedDictionary p2 = new JCG.OrderedDictionary(); int reported = 0; foreach (TaskStats stat1 in taskStats) { diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs index a99f55a381..882422ff8e 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByNameTask.cs @@ -56,7 +56,8 @@ protected virtual Report ReportSumByName(IList taskStats) { // aggregate by task name int reported = 0; - JCG.LinkedDictionary p2 = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + JCG.OrderedDictionary p2 = new JCG.OrderedDictionary(); foreach (TaskStats stat1 in taskStats) { if (stat1.Elapsed >= 0) diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs index 243ab1bb8b..2e5a22bac5 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefRoundTask.cs @@ -51,7 +51,8 @@ protected virtual Report ReportSumByPrefixRound(IList taskStats) { // aggregate by task name and by round int reported = 0; - JCG.LinkedDictionary p2 = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + JCG.OrderedDictionary p2 = new JCG.OrderedDictionary(); foreach (TaskStats stat1 in taskStats) { if (stat1.Elapsed >= 0 && stat1.Task.GetName().StartsWith(m_prefix, StringComparison.Ordinal)) diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs index 9baa93084b..6cc5e46611 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/RepSumByPrefTask.cs @@ -53,7 +53,8 @@ protected virtual Report ReportSumByPrefix(IList taskStats) { // aggregate by task name int reported = 0; - JCG.LinkedDictionary p2 = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + JCG.OrderedDictionary p2 = new JCG.OrderedDictionary(); foreach (TaskStats stat1 in taskStats) { if (stat1.Elapsed >= 0 && stat1.Task.GetName().StartsWith(m_prefix, StringComparison.Ordinal)) diff --git a/src/Lucene.Net.Benchmark/ByTask/Tasks/ReportTask.cs b/src/Lucene.Net.Benchmark/ByTask/Tasks/ReportTask.cs index b14e391741..1e6b762be9 100644 --- a/src/Lucene.Net.Benchmark/ByTask/Tasks/ReportTask.cs +++ b/src/Lucene.Net.Benchmark/ByTask/Tasks/ReportTask.cs @@ -130,7 +130,8 @@ protected virtual string TaskReportLine(string longestOp, TaskStats stat) return sb.ToString(); } - protected virtual Report GenPartialReport(int reported, JCG.LinkedDictionary partOfTasks, int totalSize) + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + protected virtual Report GenPartialReport(int reported, JCG.OrderedDictionary partOfTasks, int totalSize) { string longetOp = LongestOp(partOfTasks.Values); bool first = true; diff --git a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs index 7dec0132b5..53923cce4c 100644 --- a/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs +++ b/src/Lucene.Net.Expressions/JS/JavascriptCompiler.cs @@ -89,7 +89,8 @@ private static MethodInfo GetMethod(Type type, string method, Type[] parms) private readonly string sourceText; - private readonly IDictionary externalsMap = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + private readonly IDictionary externalsMap = new JCG.OrderedDictionary(); private TypeBuilder dynamicType; diff --git a/src/Lucene.Net.Facet/DrillDownQuery.cs b/src/Lucene.Net.Facet/DrillDownQuery.cs index 2a9fb92804..ec29f0eefa 100644 --- a/src/Lucene.Net.Facet/DrillDownQuery.cs +++ b/src/Lucene.Net.Facet/DrillDownQuery.cs @@ -76,7 +76,8 @@ public static Term Term(string field, string dim, params string[] path) private readonly FacetsConfig config; private readonly BooleanQuery query; - private readonly IDictionary drillDownDims = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + private readonly IDictionary drillDownDims = new JCG.OrderedDictionary(); /// /// Used by diff --git a/src/Lucene.Net.Grouping/Function/FunctionDistinctValuesCollector.cs b/src/Lucene.Net.Grouping/Function/FunctionDistinctValuesCollector.cs index 4a51e4c22b..888f908e9d 100644 --- a/src/Lucene.Net.Grouping/Function/FunctionDistinctValuesCollector.cs +++ b/src/Lucene.Net.Grouping/Function/FunctionDistinctValuesCollector.cs @@ -46,7 +46,8 @@ public FunctionDistinctValuesCollector(IDictionary /*Map*/ vsContext, Valu this.vsContext = vsContext; this.groupSource = groupSource; this.countSource = countSource; - groupMap = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + groupMap = new JCG.OrderedDictionary(); foreach (SearchGroup group in groups) { groupMap[group.GroupValue] = new GroupCount(group.GroupValue); diff --git a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs index 7c67bea783..76af4cf912 100644 --- a/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs +++ b/src/Lucene.Net.QueryParser/Flexible/Standard/Config/StandardQueryConfigHandler.cs @@ -50,7 +50,8 @@ public StandardQueryConfigHandler() Set(ConfigurationKeys.PHRASE_SLOP, 0); //default value 2.4 Set(ConfigurationKeys.LOWERCASE_EXPANDED_TERMS, true); //default value 2.4 Set(ConfigurationKeys.ENABLE_POSITION_INCREMENTS, false); //default value 2.4 - Set(ConfigurationKeys.FIELD_BOOST_MAP, new JCG.LinkedDictionary()); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + Set(ConfigurationKeys.FIELD_BOOST_MAP, new JCG.OrderedDictionary()); Set(ConfigurationKeys.FUZZY_CONFIG, new FuzzyConfig()); Set(ConfigurationKeys.LOCALE, null); Set(ConfigurationKeys.MULTI_TERM_REWRITE_METHOD, MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT); diff --git a/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs b/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs index 1bc74462fd..813292651c 100644 --- a/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs +++ b/src/Lucene.Net.Tests.Grouping/DistinctValuesCollectorTest.cs @@ -537,7 +537,8 @@ private IndexContext CreateIndexContext() if (!searchTermToGroupCounts.TryGetValue(content, out var groupToCounts)) { // Groups sort always DOCID asc... - searchTermToGroupCounts.Add(content, groupToCounts = new JCG.LinkedDictionary>()); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + searchTermToGroupCounts.Add(content, groupToCounts = new JCG.OrderedDictionary>()); contentStrings.Add(content); } diff --git a/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs b/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs index 15b7e115f6..485fa05074 100644 --- a/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs +++ b/src/Lucene.Net.Tests.QueryParser/Simple/TestSimpleQueryParser.cs @@ -541,7 +541,8 @@ public virtual void TestComplex06() [Test] public virtual void TestWeightedTerm() { - IDictionary weights = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + IDictionary weights = new JCG.OrderedDictionary(); weights["field0"] = 5f; weights["field1"] = 10f; @@ -562,7 +563,8 @@ public virtual void TestWeightedTerm() [Test] public virtual void TestWeightedOR() { - IDictionary weights = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + IDictionary weights = new JCG.OrderedDictionary(); weights["field0"] = 5f; weights["field1"] = 10f; diff --git a/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs b/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs index 7d3f93a121..3bc0bb6c33 100644 --- a/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs +++ b/src/Lucene.Net.Tests.Spatial/Prefix/SpatialOpRecursivePrefixTreeTest.cs @@ -231,8 +231,10 @@ private void doTest(SpatialOperation operation) bool biasContains = (operation == SpatialOperation.Contains); //Main index loop: - IDictionary indexedShapes = new JCG.LinkedDictionary(); - IDictionary indexedShapesGS = new JCG.LinkedDictionary();//grid snapped + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + IDictionary indexedShapes = new JCG.OrderedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + IDictionary indexedShapesGS = new JCG.OrderedDictionary(); //grid snapped int numIndexedShapes = randomIntBetween(1, 6); #pragma warning disable 219 bool indexedAtLeastOneShapePair = false; diff --git a/src/Lucene.Net/Index/BufferedUpdates.cs b/src/Lucene.Net/Index/BufferedUpdates.cs index af18280dde..3ef77cc996 100644 --- a/src/Lucene.Net/Index/BufferedUpdates.cs +++ b/src/Lucene.Net/Index/BufferedUpdates.cs @@ -130,7 +130,8 @@ load factor (say 2 * POINTER). Entry is object w/ // one that came in wins), and helps us detect faster if the same Term is // used to update the same field multiple times (so we later traverse it // only once). - internal readonly SCG.IDictionary> numericUpdates = new Dictionary>(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + internal readonly SCG.IDictionary> numericUpdates = new Dictionary>(); // Map> // For each field we keep an ordered list of BinaryUpdates, key'd by the @@ -139,7 +140,8 @@ load factor (say 2 * POINTER). Entry is object w/ // one that came in wins), and helps us detect faster if the same Term is // used to update the same field multiple times (so we later traverse it // only once). - internal readonly SCG.IDictionary> binaryUpdates = new Dictionary>(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + internal readonly SCG.IDictionary> binaryUpdates = new Dictionary>(); /// /// NOTE: This was MAX_INT in Lucene @@ -245,9 +247,10 @@ internal virtual void AddTerm(Term term, int docIDUpto) // LUCENENET specific - internal virtual void AddNumericUpdate(NumericDocValuesUpdate update, int docIDUpto) // LUCENENET specific - Made internal rather than public, since this class is intended to be internal but couldn't be because it is exposed through a public API { - if (!numericUpdates.TryGetValue(update.field, out LinkedDictionary fieldUpdates)) + if (!numericUpdates.TryGetValue(update.field, out OrderedDictionary fieldUpdates)) { - fieldUpdates = new LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + fieldUpdates = new OrderedDictionary(); numericUpdates[update.field] = fieldUpdates; bytesUsed.AddAndGet(BYTES_PER_NUMERIC_FIELD_ENTRY); } @@ -278,9 +281,10 @@ internal virtual void AddNumericUpdate(NumericDocValuesUpdate update, int docIDU internal virtual void AddBinaryUpdate(BinaryDocValuesUpdate update, int docIDUpto) // LUCENENET specific - Made internal rather than public, since this class is intended to be internal but couldn't be because it is exposed through a public API { - if (!binaryUpdates.TryGetValue(update.field, out LinkedDictionary fieldUpdates)) + if (!binaryUpdates.TryGetValue(update.field, out OrderedDictionary fieldUpdates)) { - fieldUpdates = new LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + fieldUpdates = new OrderedDictionary(); binaryUpdates[update.field] = fieldUpdates; bytesUsed.AddAndGet(BYTES_PER_BINARY_FIELD_ENTRY); } diff --git a/src/Lucene.Net/Search/SloppyPhraseScorer.cs b/src/Lucene.Net/Search/SloppyPhraseScorer.cs index 9f102f926c..f7e910b54f 100644 --- a/src/Lucene.Net/Search/SloppyPhraseScorer.cs +++ b/src/Lucene.Net/Search/SloppyPhraseScorer.cs @@ -452,7 +452,7 @@ private void SortRptGroups(IList> rgs) /// /// Detect repetition groups. Done once - for first doc. - private IList> GatherRptGroups(JCG.LinkedDictionary rptTerms) + private IList> GatherRptGroups(JCG.OrderedDictionary rptTerms) { PhrasePositions[] rpp = RepeatingPPs(rptTerms); IList> res = new JCG.List>(); @@ -534,9 +534,10 @@ private static int TpPos(PhrasePositions pp) // LUCENENET: CA1822: Mark members /// /// Find repeating terms and assign them ordinal values - private JCG.LinkedDictionary RepeatingTerms() + private JCG.OrderedDictionary RepeatingTerms() { - JCG.LinkedDictionary tord = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + JCG.OrderedDictionary tord = new JCG.OrderedDictionary(); Dictionary tcnt = new Dictionary(); for (PhrasePositions pp = min, prev = null; prev != max; pp = (prev = pp).next) // iterate cyclic list: done once handled max { @@ -618,7 +619,7 @@ private static void UnionTermGroups(IList bb) // LUCENENET: CA1822: /// /// Map each term to the single group that contains it - private static IDictionary TermGroups(JCG.LinkedDictionary tord, IList bb) // LUCENENET: CA1822: Mark members as static + private static IDictionary TermGroups(JCG.OrderedDictionary tord, IList bb) // LUCENENET: CA1822: Mark members as static { Dictionary tg = new Dictionary(); Term[] t = tord.Keys.ToArray(/*new Term[0]*/); diff --git a/src/Lucene.Net/Util/AttributeSource.cs b/src/Lucene.Net/Util/AttributeSource.cs index 9c63096d82..957be791bd 100644 --- a/src/Lucene.Net/Util/AttributeSource.cs +++ b/src/Lucene.Net/Util/AttributeSource.cs @@ -245,8 +245,10 @@ public AttributeSource(AttributeSource input) /// public AttributeSource(AttributeFactory factory) { - this.attributes = new JCG.LinkedDictionary(); - this.attributeImpls = new JCG.LinkedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + this.attributes = new JCG.OrderedDictionary(); + // LUCENENET specific: OrderedDictioary is a replacement for LinkedHashMap in the JDK + this.attributeImpls = new JCG.OrderedDictionary(); this.currentState = new State[1]; this.factory = factory; }