diff --git a/lucene/core/src/java/org/apache/lucene/codecs/package.html b/lucene/core/src/java/org/apache/lucene/codecs/package.html index 78dcb95..2931198 100644 --- a/lucene/core/src/java/org/apache/lucene/codecs/package.html +++ b/lucene/core/src/java/org/apache/lucene/codecs/package.html @@ -21,5 +21,46 @@ Codecs API: API for customization of the encoding and structure of the index. + +

+ The Codec API allows you to customise the way the following pieces of index information are stored: +

+

+ +

+ Codecs are identified by name through the Java Service Provider Interface. To create your own codec, extend + {@link org.apache.lucene.codecs.Codec} and pass the new codec's name to the super() constructor: +

+public class MyCodec extends Codec {
+
+    public MyCodec() {
+        super("MyCodecName");
+    }
+
+    ...
+}
+
+You will need to register the Codec class so that the {@link ServiceLoader} can find it, by including a +META-INF/services/org.apache.lucene.codecs.Codec file on your classpath that contains the package-qualified +name of your codec. +

+ +

+ If you just want to customise the {@link org.apache.lucene.codecs.PostingsFormat}, or use different postings + formats for different fields, then you can register your custom postings format in the same way (in + META-INF/services/org.apache.lucene.codecs.PostingsFormat), and then extend the default + {@link org.apache.lucene.codecs.lucene40.Lucene40Codec} and override + {@link org.apache.lucene.codecs.lucene40.Lucene40Codec#getPostingsFormatForField(String)} to return your custom + postings format. +