You will need to register the Codec class so that the 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 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
Lucene46Codec and override
Lucene46Codec.getPostingsFormatForField(String) to return your custom
postings format.