Apache Solr open-source search software
LUCENE-3553: tweak AppendingCodec to write segments_N compatible with 'normal' Lucene
Robert Muir00d8575153ad
diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingSegmentInfosReader.java b/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingSegmentInfosReader.javadeleted file mode 100644index aac8be1707d..00000000000--- a/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingSegmentInfosReader.java+++ /dev/null@@ -1,42 +0,0 @@-package org.apache.lucene.index.codecs.appending;--/*- * Licensed to the Apache Software Foundation (ASF) under one or more- * contributor license agreements. See the NOTICE file distributed with- * this work for additional information regarding copyright ownership.- * The ASF licenses this file to You under the Apache License, Version 2.0- * (the "License"); you may not use this file except in compliance with- * the License. You may obtain a copy of the License at- *- * http://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.- */--import java.io.IOException;--import org.apache.lucene.index.CorruptIndexException;-import org.apache.lucene.index.codecs.DefaultSegmentInfosReader;-import org.apache.lucene.store.Directory;-import org.apache.lucene.store.IOContext;-import org.apache.lucene.store.IndexInput;--public class AppendingSegmentInfosReader extends DefaultSegmentInfosReader {-- @Override- public void finalizeInput(IndexInput input) throws IOException,- CorruptIndexException {- input.close();- }-- @Override- public IndexInput openInput(Directory dir, String segmentsFileName, IOContext context)- throws IOException {- return dir.openInput(segmentsFileName, context);- }--}diff --git a/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingSegmentInfosWriter.java b/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingSegmentInfosWriter.javaindex 2850037ab53..1ecb3e26ff2 100644--- a/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingSegmentInfosWriter.java+++ b/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingSegmentInfosWriter.java@@ -26,17 +26,6 @@ import org.apache.lucene.store.IndexOutput;public class AppendingSegmentInfosWriter extends DefaultSegmentInfosWriter {- @Override- protected IndexOutput createOutput(Directory dir, String segmentsFileName, IOContext context)- throws IOException {- return dir.createOutput(segmentsFileName, context);- }-- @Override- public void finishCommit(IndexOutput out) throws IOException {- out.close();- }-@Overridepublic void prepareCommit(IndexOutput segmentOutput) throws IOException {// noopdiff --git a/lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java b/lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.javaindex 4c6c72f1b63..60463f716b5 100644--- a/lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java+++ b/lucene/contrib/misc/src/test/org/apache/lucene/index/codecs/appending/TestAppendingCodec.java@@ -36,6 +36,7 @@ import org.apache.lucene.index.TermsEnum;import org.apache.lucene.index.TermsEnum.SeekStatus;import org.apache.lucene.index.codecs.Codec;import org.apache.lucene.index.codecs.CodecProvider;+import org.apache.lucene.index.codecs.DefaultSegmentInfosReader;import org.apache.lucene.index.codecs.SegmentInfosReader;import org.apache.lucene.index.codecs.SegmentInfosWriter;import org.apache.lucene.store.Directory;@@ -52,7 +53,7 @@ public class TestAppendingCodec extends LuceneTestCase {static class AppendingCodecProvider extends CodecProvider {Codec appending = new AppendingCodec();SegmentInfosWriter infosWriter = new AppendingSegmentInfosWriter();- SegmentInfosReader infosReader = new AppendingSegmentInfosReader();+ SegmentInfosReader infosReader = new DefaultSegmentInfosReader();public AppendingCodecProvider() {setDefaultFieldCodec(appending.name);}