From dd6d6365ea2fab66a48da31b7b3074e14cef7089 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Thu, 25 Sep 2014 11:28:22 +0000 Subject: [PATCH] LUCENE-5969: Lucene410Codec -> backwards git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1627517 13f79535-47bb-0310-9956-ffa450edef68 --- .../codecs/lucene410/Lucene410Codec.java | 11 +++++++- .../lucene/codecs/lucene410/package.html | 25 +++++++++++++++++++ .../services/org.apache.lucene.codecs.Codec | 2 ++ .../services/org.apache.lucene.codecs.Codec | 1 - 4 files changed, 37 insertions(+), 2 deletions(-) rename lucene/{core => backward-codecs}/src/java/org/apache/lucene/codecs/lucene410/Lucene410Codec.java (93%) create mode 100644 lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene410/package.html diff --git a/lucene/core/src/java/org/apache/lucene/codecs/lucene410/Lucene410Codec.java b/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene410/Lucene410Codec.java similarity index 93% rename from lucene/core/src/java/org/apache/lucene/codecs/lucene410/Lucene410Codec.java rename to lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene410/Lucene410Codec.java index 379a133a1e9..579f267b7a2 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/lucene410/Lucene410Codec.java +++ b/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene410/Lucene410Codec.java @@ -17,11 +17,14 @@ package org.apache.lucene.codecs.lucene410; * limitations under the License. */ +import java.io.IOException; + import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.DocValuesFormat; import org.apache.lucene.codecs.FieldInfosFormat; import org.apache.lucene.codecs.FilterCodec; import org.apache.lucene.codecs.LiveDocsFormat; +import org.apache.lucene.codecs.NormsConsumer; import org.apache.lucene.codecs.NormsFormat; import org.apache.lucene.codecs.PostingsFormat; import org.apache.lucene.codecs.SegmentInfoFormat; @@ -35,6 +38,7 @@ import org.apache.lucene.codecs.lucene46.Lucene46SegmentInfoFormat; import org.apache.lucene.codecs.lucene49.Lucene49NormsFormat; import org.apache.lucene.codecs.perfield.PerFieldDocValuesFormat; import org.apache.lucene.codecs.perfield.PerFieldPostingsFormat; +import org.apache.lucene.index.SegmentWriteState; /** * Implements the Lucene 4.10 index format, with configurable per-field postings @@ -131,7 +135,12 @@ public class Lucene410Codec extends Codec { private final PostingsFormat defaultFormat = PostingsFormat.forName("Lucene41"); private final DocValuesFormat defaultDVFormat = DocValuesFormat.forName("Lucene410"); - private final NormsFormat normsFormat = new Lucene49NormsFormat(); + private final NormsFormat normsFormat = new Lucene49NormsFormat() { + @Override + public NormsConsumer normsConsumer(SegmentWriteState state) throws IOException { + throw new UnsupportedOperationException("this codec can only be used for reading"); + } + }; @Override public final NormsFormat normsFormat() { diff --git a/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene410/package.html b/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene410/package.html new file mode 100644 index 00000000000..0aad87f6af2 --- /dev/null +++ b/lucene/backward-codecs/src/java/org/apache/lucene/codecs/lucene410/package.html @@ -0,0 +1,25 @@ + + + + + + + +Lucene 4.10 file format. + + \ No newline at end of file diff --git a/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.Codec b/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.Codec index ccb80e45c7b..8dfd608c4b7 100644 --- a/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.Codec +++ b/lucene/backward-codecs/src/resources/META-INF/services/org.apache.lucene.codecs.Codec @@ -19,3 +19,5 @@ org.apache.lucene.codecs.lucene42.Lucene42Codec org.apache.lucene.codecs.lucene45.Lucene45Codec org.apache.lucene.codecs.lucene46.Lucene46Codec org.apache.lucene.codecs.lucene49.Lucene49Codec +org.apache.lucene.codecs.lucene410.Lucene410Codec + diff --git a/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.Codec b/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.Codec index df4968b73c9..2d066a7234c 100644 --- a/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.Codec +++ b/lucene/core/src/resources/META-INF/services/org.apache.lucene.codecs.Codec @@ -13,5 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -org.apache.lucene.codecs.lucene410.Lucene410Codec org.apache.lucene.codecs.lucene50.Lucene50Codec