public override int map(int old) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int oldWithDeletes = old + (int) deletes.get(old); int oldWithDeletes = old + (int)deletes.get(old); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int newWithDeletes = docMap.oldToNew(oldWithDeletes); int newWithDeletes = outerInstance.docMap.oldToNew(oldWithDeletes); return(mergeState.docMaps[0].get(newWithDeletes)); }
public override int newToOld(int docID) { return((int)newToOld.get(docID)); }
public override int oldToNew(int docID) { return((int)oldToNew.get(docID)); }
/// <summary> /// Computes the old-to-new permutation over the given comparator. </summary> //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private static Sorter.DocMap sort(final int maxDoc, DocComparator comparator) private static Sorter.DocMap sort(int maxDoc, DocComparator comparator) { // check if the index is sorted bool sorted = true; for (int i = 1; i < maxDoc; ++i) { if (comparator.compare(i - 1, i) > 0) { sorted = false; break; } } if (sorted) { return(null); } // sort doc IDs //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int[] docs = new int[maxDoc]; int[] docs = new int[maxDoc]; for (int i = 0; i < maxDoc; i++) { docs[i] = i; } DocValueSorter sorter = new DocValueSorter(docs, comparator); // It can be common to sort a reader, add docs, sort it again, ... and in // that case timSort can save a lot of time sorter.sort(0, docs.Length); // docs is now the newToOld mapping // The reason why we use MonotonicAppendingLongBuffer here is that it // wastes very little memory if the index is in random order but can save // a lot of memory if the index is already "almost" sorted //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.apache.lucene.util.packed.MonotonicAppendingLongBuffer newToOld = new org.apache.lucene.util.packed.MonotonicAppendingLongBuffer(); MonotonicAppendingLongBuffer newToOld = new MonotonicAppendingLongBuffer(); for (int i = 0; i < maxDoc; ++i) { newToOld.add(docs[i]); } newToOld.freeze(); for (int i = 0; i < maxDoc; ++i) { docs[(int)newToOld.get(i)] = i; } // docs is now the oldToNew mapping //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.apache.lucene.util.packed.MonotonicAppendingLongBuffer oldToNew = new org.apache.lucene.util.packed.MonotonicAppendingLongBuffer(); MonotonicAppendingLongBuffer oldToNew = new MonotonicAppendingLongBuffer(); for (int i = 0; i < maxDoc; ++i) { oldToNew.add(docs[i]); } oldToNew.freeze(); return(new DocMapAnonymousInnerClassHelper(maxDoc, newToOld, oldToNew)); }