1
package org.apache.lucene.analysis;
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
11
* http://www.apache.org/licenses/LICENSE-2.0
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.
20
import java.io.Reader;
22
import org.apache.lucene.util.Version;
24
/** An {@link Analyzer} that filters {@link LetterTokenizer}
25
* with {@link LowerCaseFilter}
27
* <a name="version">You must specify the required {@link Version} compatibility
28
* when creating {@link CharTokenizer}:
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>
36
public final class SimpleAnalyzer extends ReusableAnalyzerBase {
38
private final Version matchVersion;
41
* Creates a new {@link SimpleAnalyzer}
42
* @param matchVersion Lucene version to match See {@link <a href="#version">above</a>}
44
public SimpleAnalyzer(Version matchVersion) {
45
this.matchVersion = matchVersion;
49
* Creates a new {@link SimpleAnalyzer}
50
* @deprecated use {@link #SimpleAnalyzer(Version)} instead
52
@Deprecated public SimpleAnalyzer() {
53
this(Version.LUCENE_30);
56
protected TokenStreamComponents createComponents(final String fieldName,
57
final Reader reader) {
58
return new TokenStreamComponents(new LowerCaseTokenizer(matchVersion, reader));