示例#1
0
		// 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;
			}
		}
示例#2
0
        // 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;
                }
            }
        }
示例#3
0
		/// <summary>Called whenever a merge has completed and the merged segments had deletions </summary>
		internal void  RemapDeletes(SegmentInfos infos, int[][] docMaps, int[] delCounts, MergePolicy.OneMerge merge, int mergeDocCount)
		{
			lock (this)
			{
				if (docMaps == null)
				// The merged segments had no deletes so docIDs did not change and we have nothing to do
					return ;
				MergeDocIDRemapper mapper = new MergeDocIDRemapper(infos, docMaps, delCounts, merge, mergeDocCount);
				deletesInRAM.Remap(mapper, infos, docMaps, delCounts, merge, mergeDocCount);
				deletesFlushed.Remap(mapper, infos, docMaps, delCounts, merge, mergeDocCount);
				flushedDocCount -= mapper.docShift;
			}
		}