You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2012/07/05 16:00:20 UTC
svn commit: r1357612 - in /lucene/dev/branches/branch_4x: ./ lucene/
lucene/CHANGES.txt lucene/core/
lucene/core/src/java/org/apache/lucene/codecs/package.html
Author: rmuir
Date: Thu Jul 5 14:00:19 2012
New Revision: 1357612
URL: http://svn.apache.org/viewvc?rev=1357612&view=rev
Log:
LUCENE-4195: codec package documentation
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/package.html
Modified: lucene/dev/branches/branch_4x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/CHANGES.txt?rev=1357612&r1=1357611&r2=1357612&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/lucene/CHANGES.txt Thu Jul 5 14:00:19 2012
@@ -61,6 +61,11 @@ Build
* LUCENE-4115: JAR resolution/ cleanup should be done automatically for ant
clean/ eclipse/ resolve (Dawid Weiss)
+Documentation
+
+* LUCENE-4195: Added package documentation and examples for
+ org.apache.lucene.codecs (Alan Woodward via Robert Muir)
+
======================= Lucene 4.0.0-ALPHA =======================
More information about this release, including any errata related to the
release notes, upgrade instructions, or other changes may be found online at:
Modified: lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/package.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/package.html?rev=1357612&r1=1357611&r2=1357612&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/package.html (original)
+++ lucene/dev/branches/branch_4x/lucene/core/src/java/org/apache/lucene/codecs/package.html Thu Jul 5 14:00:19 2012
@@ -21,5 +21,46 @@
</head>
<body>
Codecs API: API for customization of the encoding and structure of the index.
+
+<p>
+ The Codec API allows you to customise the way the following pieces of index information are stored:
+<ul>
+ <li>Postings lists - see {@link org.apache.lucene.codecs.PostingsFormat}</li>
+ <li>DocValues - see {@link org.apache.lucene.codecs.DocValuesFormat}</li>
+ <li>Stored fields - see {@link org.apache.lucene.codecs.StoredFieldsFormat}</li>
+ <li>Term vectors - see {@link org.apache.lucene.codecs.TermVectorsFormat}</li>
+ <li>FieldInfos - see {@link org.apache.lucene.codecs.FieldInfosFormat}</li>
+ <li>SegmentInfo - see {@link org.apache.lucene.codecs.SegmentInfoFormat}</li>
+ <li>Norms - see {@link org.apache.lucene.codecs.NormsFormat}</li>
+ <li>Live documents - see {@link org.apache.lucene.codecs.LiveDocsFormat}</li>
+</ul>
+</p>
+
+<p>
+ 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:
+<pre class="prettyprint">
+public class MyCodec extends Codec {
+
+ public MyCodec() {
+ super("MyCodecName");
+ }
+
+ ...
+}
+</pre>
+You will need to register the Codec class so that the {@link java.util.ServiceLoader 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.
+</p>
+
+<p>
+ 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.
+</p>
</body>
</html>