Skip to content

Apache Lucene open-source search software

remove some dead/unnecessary code

Michael McCandless8e79f64fbcfd
diff --git a/src/java/org/apache/lucene/index/DocumentsWriter.java b/src/java/org/apache/lucene/index/DocumentsWriter.java
index e354235ad64..383dfd08aff 100644
--- a/src/java/org/apache/lucene/index/DocumentsWriter.java
+++ b/src/java/org/apache/lucene/index/DocumentsWriter.java
@@ -726,8 +726,6 @@ final class DocumentsWriter {
fp.docFields[fp.fieldCount++] = field;
}
- final int numFields = fieldInfos.size();
-
// Maybe init the local & global fieldsWriter
if (localFieldsWriter == null) {
if (fieldsWriter == null) {
@@ -764,11 +762,11 @@ final class DocumentsWriter {
}
/** Do in-place sort of Posting array */
- final void doPostingSort(Posting[] postings, int numPosting) {
+ void doPostingSort(Posting[] postings, int numPosting) {
quickSort(postings, 0, numPosting-1);
}
- final void quickSort(Posting[] postings, int lo, int hi) {
+ void quickSort(Posting[] postings, int lo, int hi) {
if (lo >= hi)
return;
@@ -822,11 +820,11 @@ final class DocumentsWriter {
}
/** Do in-place sort of PostingVector array */
- final void doVectorSort(PostingVector[] postings, int numPosting) {
+ void doVectorSort(PostingVector[] postings, int numPosting) {
quickSort(postings, 0, numPosting-1);
}
- final void quickSort(PostingVector[] postings, int lo, int hi) {
+ void quickSort(PostingVector[] postings, int lo, int hi) {
if (lo >= hi)
return;
@@ -1040,7 +1038,6 @@ final class DocumentsWriter {
/** Write vInt into freq stream of current Posting */
public void writeFreqVInt(int i) {
- int upto = 0;
while ((i & ~0x7F) != 0) {
writeFreqByte((byte)((i & 0x7f) | 0x80));
i >>>= 7;
@@ -1050,7 +1047,6 @@ final class DocumentsWriter {
/** Write vInt into prox stream of current Posting */
public void writeProxVInt(int i) {
- int upto = 0;
while ((i & ~0x7F) != 0) {
writeProxByte((byte)((i & 0x7f) | 0x80));
i >>>= 7;
@@ -1106,7 +1102,6 @@ final class DocumentsWriter {
/** Write vInt into offsets stream of current
* PostingVector */
public void writeOffsetVInt(int i) {
- int upto = 0;
while ((i & ~0x7F) != 0) {
writeOffsetByte((byte)((i & 0x7f) | 0x80));
i >>>= 7;
@@ -1132,7 +1127,6 @@ final class DocumentsWriter {
/** Write vInt into pos stream of current
* PostingVector */
public void writePosVInt(int i) {
- int upto = 0;
while ((i & ~0x7F) != 0) {
writePosByte((byte)((i & 0x7f) | 0x80));
i >>>= 7;
@@ -1240,7 +1234,6 @@ final class DocumentsWriter {
offset = 0;
boost = docBoost;
- final int startNumPostings = numPostings;
final int maxFieldLength = writer.getMaxFieldLength();
final int limit = fieldCount;
@@ -1401,7 +1394,6 @@ final class DocumentsWriter {
final int tokenTextLen = token.termLength();
int code = 0;
- int code2 = 0;
// Compute hashcode
int downto = tokenTextLen;
@@ -1965,7 +1957,6 @@ final class DocumentsWriter {
assert result;
}
- Posting lastPosting = null;
final int skipInterval = termsOut.skipInterval;
currentFieldStorePayloads = fields[0].fieldInfo.storePayloads;
diff --git a/src/java/org/apache/lucene/index/IndexFileDeleter.java b/src/java/org/apache/lucene/index/IndexFileDeleter.java
index 1a7792574d2..62ed06f52a7 100644
--- a/src/java/org/apache/lucene/index/IndexFileDeleter.java
+++ b/src/java/org/apache/lucene/index/IndexFileDeleter.java
@@ -17,9 +17,6 @@ package org.apache.lucene.index;
* limitations under the License.
*/
-import org.apache.lucene.index.IndexFileNames;
-import org.apache.lucene.index.SegmentInfos;
-import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.store.Directory;
import java.io.IOException;
@@ -562,11 +559,11 @@ final class IndexFileDeleter {
int count;
- final public int IncRef() {
+ public int IncRef() {
return ++count;
}
- final public int DecRef() {
+ public int DecRef() {
assert count > 0;
return --count;
}
diff --git a/src/java/org/apache/lucene/index/IndexWriter.java b/src/java/org/apache/lucene/index/IndexWriter.java
index f6c440d1446..c0ffe61fd19 100644
--- a/src/java/org/apache/lucene/index/IndexWriter.java
+++ b/src/java/org/apache/lucene/index/IndexWriter.java
@@ -2073,8 +2073,6 @@ public class IndexWriter {
message("flush at addIndexes");
flush();
- int start = segmentInfos.size();
-
boolean success = false;
startTransaction();
@@ -2580,7 +2578,6 @@ public class IndexWriter {
try {
SegmentInfos sourceSegmentsClone = merge.segmentsClone;
SegmentInfos sourceSegments = merge.segments;
- final int numSegments = segmentInfos.size();
start = ensureContiguousMerge(merge);
if (infoStream != null)
@@ -2741,7 +2738,6 @@ public class IndexWriter {
assert merge.registerDone;
- int mergedDocCount;
boolean success = false;
try {
@@ -2752,7 +2748,7 @@ public class IndexWriter {
if (infoStream != null)
message("now merge\n merge=" + merge.segString(directory) + "\n index=" + segString());
- mergedDocCount = mergeMiddle(merge);
+ mergeMiddle(merge);
success = true;
} finally {
@@ -2833,9 +2829,8 @@ public class IndexWriter {
final SegmentInfos sourceSegments = merge.segments;
final int end = sourceSegments.size();
- final int numSegments = segmentInfos.size();
- final int start = ensureContiguousMerge(merge);
+ ensureContiguousMerge(merge);
// Check whether this merge will allow us to skip
// merging the doc stores (stored field & vectors).
@@ -2959,7 +2954,6 @@ public class IndexWriter {
assert merge.registerDone;
final SegmentInfos sourceSegments = merge.segments;
- final SegmentInfos sourceSegmentsClone = merge.segmentsClone;
final int end = sourceSegments.size();
for(int i=0;i<end;i++)
mergingSegments.remove(sourceSegments.info(i));
diff --git a/src/java/org/apache/lucene/index/LogMergePolicy.java b/src/java/org/apache/lucene/index/LogMergePolicy.java
index 87d41bc2e7f..fdfb6cd48b9 100644
--- a/src/java/org/apache/lucene/index/LogMergePolicy.java
+++ b/src/java/org/apache/lucene/index/LogMergePolicy.java
@@ -168,7 +168,6 @@ public abstract class LogMergePolicy extends MergePolicy {
* (mergeFactor at a time) so the {@link MergeScheduler}
* in use may make use of concurrency. */
public MergeSpecification findMergesForOptimize(SegmentInfos infos, IndexWriter writer, int maxNumSegments, Set segmentsToOptimize) throws IOException {
- final Directory dir = writer.getDirectory();
MergeSpecification spec;
if (!isOptimized(infos, writer, maxNumSegments, segmentsToOptimize)) {