LUCENE-3755: add simple example to javadocs of Analyzer and ref package docs for more examples

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1376614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-08-23 17:58:56 +00:00
parent 6368e03ef8
commit db64ca99f5
1 changed files with 15 additions and 1 deletions

View File

@ -30,8 +30,22 @@ import java.util.Map;
* policy for extracting index terms from text.
* <p>
* In order to define what analysis is done, subclasses must define their
* {@link TokenStreamComponents} in {@link #createComponents(String, Reader)}.
* {@link TokenStreamComponents TokenStreamComponents} in {@link #createComponents(String, Reader)}.
* The components are then reused in each call to {@link #tokenStream(String, Reader)}.
* <p>
* Simple example:
* <pre class="prettyprint">
* Analyzer analyzer = new Analyzer() {
* {@literal @Override}
* protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
* Tokenizer source = new FooTokenizer(reader);
* TokenStream filter = new FooFilter(source);
* filter = new BarFilter(filter);
* return new TokenStreamComponents(source, filter);
* }
* };
* </pre>
* For more examples, see the {@link org.apache.lucene.analysis Analysis package documentation}.
*/
public abstract class Analyzer {