mirror of https://github.com/apache/lucene.git
LUCENE-3553: tweak AppendingCodec to write segments_N compatible with 'normal' Lucene
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1197086 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
687c056fb0
commit
00d8575153
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareCommit(IndexOutput segmentOutput) throws IOException {
|
||||
// noop
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue