Skip to content

Commit 6ede42b

Browse files
committed
merge lucene_4
2 parents ac3501b + 978c956 commit 6ede42b

File tree

504 files changed

+6591
-8456
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

504 files changed

+6591
-8456
lines changed

pom.xml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
</parent>
3131

3232
<properties>
33-
<lucene.version>3.6.1</lucene.version>
33+
<lucene.version>4.0.0</lucene.version>
3434
</properties>
3535

3636
<repositories>
@@ -51,7 +51,13 @@
5151
</dependency>
5252
<dependency>
5353
<groupId>org.apache.lucene</groupId>
54-
<artifactId>lucene-analyzers</artifactId>
54+
<artifactId>lucene-analyzers-common</artifactId>
55+
<version>${lucene.version}</version>
56+
<scope>compile</scope>
57+
</dependency>
58+
<dependency>
59+
<groupId>org.apache.lucene</groupId>
60+
<artifactId>lucene-codecs</artifactId>
5561
<version>${lucene.version}</version>
5662
<scope>compile</scope>
5763
</dependency>
@@ -79,6 +85,13 @@
7985
<version>${lucene.version}</version>
8086
<scope>compile</scope>
8187
</dependency>
88+
<dependency>
89+
<groupId>org.apache.lucene</groupId>
90+
<artifactId>lucene-queryparser</artifactId>
91+
<version>${lucene.version}</version>
92+
<scope>compile</scope>
93+
</dependency>
94+
8295

8396
<!-- START: dependencies that are shaded -->
8497
<dependency>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Licensed to ElasticSearch and Shay Banon under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. ElasticSearch licenses this
6+
* file to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.apache.lucene.analysis;
21+
22+
import java.io.Reader;
23+
24+
/**
25+
* Extension to {@link Analyzer} suitable for Analyzers which wrap
26+
* other Analyzers.
27+
* <p/>
28+
* {@link #getWrappedAnalyzer(String)} allows the Analyzer
29+
* to wrap multiple Analyzers which are selected on a per field basis.
30+
* <p/>
31+
* {@link #wrapComponents(String, Analyzer.TokenStreamComponents)} allows the
32+
* TokenStreamComponents of the wrapped Analyzer to then be wrapped
33+
* (such as adding a new {@link TokenFilter} to form new TokenStreamComponents.
34+
*/
35+
public abstract class CustomAnalyzerWrapper extends Analyzer {
36+
37+
/**
38+
* Creates a new CustomAnalyzerWrapper. Since the {@link Analyzer.ReuseStrategy} of
39+
* the wrapped Analyzers are unknown, {@link Analyzer.PerFieldReuseStrategy} is assumed
40+
*/
41+
protected CustomAnalyzerWrapper() {
42+
super(new PerFieldReuseStrategy());
43+
}
44+
45+
/**
46+
* Retrieves the wrapped Analyzer appropriate for analyzing the field with
47+
* the given name
48+
*
49+
* @param fieldName Name of the field which is to be analyzed
50+
* @return Analyzer for the field with the given name. Assumed to be non-null
51+
*/
52+
protected abstract Analyzer getWrappedAnalyzer(String fieldName);
53+
54+
/**
55+
* Wraps / alters the given TokenStreamComponents, taken from the wrapped
56+
* Analyzer, to form new components. It is through this method that new
57+
* TokenFilters can be added by AnalyzerWrappers.
58+
*
59+
*
60+
* @param fieldName Name of the field which is to be analyzed
61+
* @param components TokenStreamComponents taken from the wrapped Analyzer
62+
* @return Wrapped / altered TokenStreamComponents.
63+
*/
64+
protected abstract TokenStreamComponents wrapComponents(String fieldName, TokenStreamComponents components);
65+
66+
@Override
67+
protected final TokenStreamComponents createComponents(String fieldName, Reader aReader) {
68+
return wrapComponents(fieldName, getWrappedAnalyzer(fieldName).createComponents(fieldName, aReader));
69+
}
70+
71+
@Override
72+
public int getPositionIncrementGap(String fieldName) {
73+
return getWrappedAnalyzer(fieldName).getPositionIncrementGap(fieldName);
74+
}
75+
76+
@Override
77+
public int getOffsetGap(String fieldName) {
78+
return getWrappedAnalyzer(fieldName).getOffsetGap(fieldName);
79+
}
80+
81+
@Override
82+
public final Reader initReader(String fieldName, Reader reader) {
83+
return getWrappedAnalyzer(fieldName).initReader(fieldName, reader);
84+
}
85+
}

src/main/java/org/apache/lucene/analysis/miscellaneous/TrimFilter.java

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/main/java/org/apache/lucene/analysis/miscellaneous/UniqueTokenFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919

2020
package org.apache.lucene.analysis.miscellaneous;
2121

22-
import org.apache.lucene.analysis.CharArraySet;
2322
import org.apache.lucene.analysis.TokenFilter;
2423
import org.apache.lucene.analysis.TokenStream;
2524
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
2625
import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
26+
import org.apache.lucene.analysis.util.CharArraySet;
2727
import org.apache.lucene.util.Version;
2828

2929
import java.io.IOException;

0 commit comments

Comments
 (0)