mirror of https://github.com/apache/lucene.git
lucene 2.4-dev r688745
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@689510 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6e84739ca4
commit
c22010a1c3
|
@ -614,6 +614,7 @@ Other Changes
|
|||
|
||||
23. SOLR-692: Migrated to stable released builds of StAX API 1.0.1 and StAX 1.2.0 (shalin)
|
||||
24. Upgraded to Lucene 2.4-dev (r686801) (yonik)
|
||||
24. Upgraded to Lucene 2.4-dev (r688745) 27-Aug-2008 (yonik)
|
||||
|
||||
Build
|
||||
1. SOLR-411. Changed the names of the Solr JARs to use the defacto standard JAR names based on
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
AnyObjectId[21285828e9eedf3b37e52f40dbd50f6e02550e58] was removed in git history.
|
||||
AnyObjectId[a297b74977020019fe7ac607df2e8ec573944e9c] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -1,2 +1,2 @@
|
|||
AnyObjectId[a01a0a819db377c8ef1c8c7ec1c2e339c84aa83b] was removed in git history.
|
||||
AnyObjectId[596625b0a1fdfb00581cabc31eac3fd7dbbe86a7] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -1,2 +1,2 @@
|
|||
AnyObjectId[51896ad69d2555a5617ccf10a01e108587a8a3cc] was removed in git history.
|
||||
AnyObjectId[db13718008ec899c69ebf640ae649b58135b062b] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -1,2 +1,2 @@
|
|||
AnyObjectId[eb33a0409a51a0851d12f5c67cd36cdb46549950] was removed in git history.
|
||||
AnyObjectId[50c8cb42b852c394331912a1b325f5284f0de099] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -1,2 +1,2 @@
|
|||
AnyObjectId[80795011a13631dc55cf066092be1808ea5b28bd] was removed in git history.
|
||||
AnyObjectId[aef3fb8813eba25eb578dd494e29088df70ff466] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -1,2 +1,2 @@
|
|||
AnyObjectId[098ccf5c3e15a3202d6e39cb35e01472916ebc3f] was removed in git history.
|
||||
AnyObjectId[1c733b90279fb1e1911f35f0459220470a9c0307] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -1,2 +1,2 @@
|
|||
AnyObjectId[5a7f760a8495cc7bf36303e0c75aba876fe8b68d] was removed in git history.
|
||||
AnyObjectId[0195fa2b64ba96a234fec689e0d54fd4ed10bc97] was removed in git history.
|
||||
Apache SVN contains full history.
|
|
@ -75,12 +75,12 @@ public class EnglishPorterFilterFactory extends BaseTokenFilterFactory implement
|
|||
*/
|
||||
class EnglishPorterFilter extends TokenFilter {
|
||||
private final CharArraySet protWords;
|
||||
private net.sf.snowball.ext.EnglishStemmer stemmer;
|
||||
private org.tartarus.snowball.ext.EnglishStemmer stemmer;
|
||||
|
||||
public EnglishPorterFilter(TokenStream source, CharArraySet protWords) {
|
||||
super(source);
|
||||
this.protWords = protWords;
|
||||
stemmer = new net.sf.snowball.ext.EnglishStemmer();
|
||||
stemmer = new org.tartarus.snowball.ext.EnglishStemmer();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.lucene.analysis.TokenStream;
|
||||
import org.apache.lucene.analysis.snowball.SnowballFilter;
|
||||
import org.tartarus.snowball.SnowballProgram;
|
||||
|
||||
/**
|
||||
* Factory for SnowballFilters, with configurable language
|
||||
|
@ -31,16 +32,29 @@ import org.apache.lucene.analysis.snowball.SnowballFilter;
|
|||
*/
|
||||
public class SnowballPorterFilterFactory extends BaseTokenFilterFactory {
|
||||
private String language = "English";
|
||||
|
||||
private Class stemClass;
|
||||
|
||||
@Override
|
||||
public void init(Map<String, String> args) {
|
||||
super.init(args);
|
||||
final String cfgLanguage = args.get("language");
|
||||
if(cfgLanguage!=null) language = cfgLanguage;
|
||||
|
||||
try {
|
||||
stemClass = Class.forName("org.tartarus.snowball.ext." + language + "Stemmer");
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException("Can't find class for stemmer language " + language, e);
|
||||
}
|
||||
}
|
||||
|
||||
public SnowballFilter create(TokenStream input) {
|
||||
return new SnowballFilter(input,language);
|
||||
SnowballProgram program;
|
||||
try {
|
||||
program = (SnowballProgram)stemClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Error instantiating stemmer for language " + language + "from class " +stemClass, e);
|
||||
}
|
||||
return new SnowballFilter(input, program);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ package org.apache.solr.analysis;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import net.sf.snowball.ext.EnglishStemmer;
|
||||
import org.apache.solr.common.ResourceLoader;
|
||||
import org.tartarus.snowball.ext.EnglishStemmer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -30,7 +30,7 @@ import java.util.Collections;
|
|||
public class EnglishPorterFilterFactoryTest extends BaseTokenTestCase {
|
||||
|
||||
public void test() throws IOException {
|
||||
EnglishStemmer stemmer = new net.sf.snowball.ext.EnglishStemmer();
|
||||
EnglishStemmer stemmer = new EnglishStemmer();
|
||||
String[] test = {"The", "fledgling", "banks", "were", "counting", "on", "a", "big", "boom", "in", "banking"};
|
||||
StringBuilder gold = new StringBuilder();
|
||||
for (int i = 0; i < test.length; i++) {
|
||||
|
@ -49,7 +49,7 @@ public class EnglishPorterFilterFactoryTest extends BaseTokenTestCase {
|
|||
}
|
||||
|
||||
public void testProtected() throws Exception {
|
||||
EnglishStemmer stemmer = new net.sf.snowball.ext.EnglishStemmer();
|
||||
EnglishStemmer stemmer = new EnglishStemmer();
|
||||
String[] test = {"The", "fledgling", "banks", "were", "counting", "on", "a", "big", "boom", "in", "banking"};
|
||||
StringBuilder gold = new StringBuilder();
|
||||
for (int i = 0; i < test.length; i++) {
|
||||
|
|
Loading…
Reference in New Issue