// Remaps all buffered deletes based on a completed // merge internal virtual void Remap(MergeDocIDRemapper mapper, SegmentInfos infos, int[][] docMaps, int[] delCounts, MergePolicy.OneMerge merge, int mergeDocCount) { lock (this) { IDictionary <Term, Num> newDeleteTerms; // Remap delete-by-term if (terms.Count > 0) { if (doTermSort) { newDeleteTerms = new SortedDictionary <Term, Num>(); } else { newDeleteTerms = new HashMap <Term, Num>(); } foreach (var entry in terms) { Num num = entry.Value; newDeleteTerms[entry.Key] = new Num(mapper.Remap(num.GetNum())); } } else { newDeleteTerms = null; } // Remap delete-by-docID List <int> newDeleteDocIDs; if (docIDs.Count > 0) { newDeleteDocIDs = new List <int>(docIDs.Count); foreach (int num in docIDs) { newDeleteDocIDs.Add(mapper.Remap(num)); } } else { newDeleteDocIDs = null; } // Remap delete-by-query HashMap <Query, int> newDeleteQueries; if (queries.Count > 0) { newDeleteQueries = new HashMap <Query, int>(queries.Count); foreach (var entry in queries) { int num = entry.Value; newDeleteQueries[entry.Key] = mapper.Remap(num); } } else { newDeleteQueries = null; } if (newDeleteTerms != null) { terms = newDeleteTerms; } if (newDeleteDocIDs != null) { docIDs = newDeleteDocIDs; } if (newDeleteQueries != null) { queries = newDeleteQueries; } } }
// Remaps all buffered deletes based on a completed // merge internal virtual void Remap(MergeDocIDRemapper mapper, SegmentInfos infos, int[][] docMaps, int[] delCounts, MergePolicy.OneMerge merge, int mergeDocCount) { lock (this) { System.Collections.IDictionary newDeleteTerms; // Remap delete-by-term if (terms.Count > 0) { if (doTermSort) { newDeleteTerms = new System.Collections.Generic.SortedDictionary <object, object>(); } else { newDeleteTerms = new System.Collections.Hashtable(); } System.Collections.IEnumerator iter = new System.Collections.Hashtable(terms).GetEnumerator(); while (iter.MoveNext()) { System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)iter.Current; Num num = (Num)entry.Value; newDeleteTerms[entry.Key] = new Num(mapper.Remap(num.GetNum())); } } else { newDeleteTerms = null; } // Remap delete-by-docID System.Collections.ArrayList newDeleteDocIDs; if (docIDs.Count > 0) { newDeleteDocIDs = new System.Collections.ArrayList(docIDs.Count); System.Collections.IEnumerator iter = docIDs.GetEnumerator(); while (iter.MoveNext()) { System.Int32 num = (System.Int32)iter.Current; newDeleteDocIDs.Add((System.Int32)mapper.Remap(num)); } } else { newDeleteDocIDs = null; } // Remap delete-by-query System.Collections.Hashtable newDeleteQueries; if (queries.Count > 0) { newDeleteQueries = new System.Collections.Hashtable(queries.Count); System.Collections.IEnumerator iter = new System.Collections.Hashtable(queries).GetEnumerator(); while (iter.MoveNext()) { System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry)iter.Current; System.Int32 num = (System.Int32)entry.Value; newDeleteQueries[entry.Key] = (System.Int32)mapper.Remap(num); } } else { newDeleteQueries = null; } if (newDeleteTerms != null) { terms = newDeleteTerms; } if (newDeleteDocIDs != null) { docIDs = newDeleteDocIDs; } if (newDeleteQueries != null) { queries = newDeleteQueries; } } }
// Remaps all buffered deletes based on a completed // merge internal void Remap(MergeDocIDRemapper mapper, SegmentInfos infos, int[][] docMaps, int[] delCounts, MergePolicy.OneMerge merge, int mergeDocCount) { lock (this) { IDictionary <object, object> newDeleteTerms; // Remap delete-by-term if (terms.Count > 0) { newDeleteTerms = new Dictionary <object, object>(); IEnumerator <KeyValuePair <object, object> > iter = terms.GetEnumerator(); while (iter.MoveNext()) { KeyValuePair <object, object> entry = (KeyValuePair <object, object>)iter.Current; Num num = (Num)entry.Value; newDeleteTerms[entry.Key] = new Num(mapper.Remap(num.GetNum())); } } else { newDeleteTerms = null; } // Remap delete-by-docID IList <object> newDeleteDocIDs; if (docIDs.Count > 0) { newDeleteDocIDs = new List <object>(docIDs.Count); IEnumerator <object> iter = docIDs.GetEnumerator(); while (iter.MoveNext()) { int num = (int)iter.Current; newDeleteDocIDs.Add(mapper.Remap(num)); } } else { newDeleteDocIDs = null; } // Remap delete-by-query IDictionary <object, object> newDeleteQueries; if (queries.Count > 0) { newDeleteQueries = new Dictionary <object, object>(queries.Count); IEnumerator <KeyValuePair <object, object> > iter = queries.GetEnumerator(); while (iter.MoveNext()) { KeyValuePair <object, object> entry = (KeyValuePair <object, object>)iter.Current; int num = (int)entry.Value; newDeleteQueries[entry.Key] = mapper.Remap(num); } } else { newDeleteQueries = null; } if (newDeleteTerms != null) { terms = newDeleteTerms; } if (newDeleteDocIDs != null) { docIDs = newDeleteDocIDs; } if (newDeleteQueries != null) { queries = newDeleteQueries; } } }