add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / src / java / org / apache / lucene / analysis / SimpleAnalyzer.java
1 package org.apache.lucene.analysis;
2
3 /**
4  * Licensed to the Apache Software Foundation (ASF) under one or more
5  * contributor license agreements.  See the NOTICE file distributed with
6  * this work for additional information regarding copyright ownership.
7  * The ASF licenses this file to You under the Apache License, Version 2.0
8  * (the "License"); you may not use this file except in compliance with
9  * the License.  You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 import java.io.Reader;
21
22 import org.apache.lucene.util.Version;
23
24 /** An {@link Analyzer} that filters {@link LetterTokenizer} 
25  *  with {@link LowerCaseFilter} 
26  * <p>
27  * <a name="version">You must specify the required {@link Version} compatibility
28  * when creating {@link CharTokenizer}:
29  * <ul>
30  * <li>As of 3.1, {@link LowerCaseTokenizer} uses an int based API to normalize and
31  * detect token codepoints. See {@link CharTokenizer#isTokenChar(int)} and
32  * {@link CharTokenizer#normalize(int)} for details.</li>
33  * </ul>
34  * <p>
35  **/
36 public final class SimpleAnalyzer extends ReusableAnalyzerBase {
37
38   private final Version matchVersion;
39   
40   /**
41    * Creates a new {@link SimpleAnalyzer}
42    * @param matchVersion Lucene version to match See {@link <a href="#version">above</a>}
43    */
44   public SimpleAnalyzer(Version matchVersion) {
45     this.matchVersion = matchVersion;
46   }
47   
48   /**
49    * Creates a new {@link SimpleAnalyzer}
50    * @deprecated use {@link #SimpleAnalyzer(Version)} instead 
51    */
52   @Deprecated  public SimpleAnalyzer() {
53     this(Version.LUCENE_30);
54   }
55   @Override
56   protected TokenStreamComponents createComponents(final String fieldName,
57       final Reader reader) {
58     return new TokenStreamComponents(new LowerCaseTokenizer(matchVersion, reader));
59   }
60 }