LUCENE-2404: Add Solr part (luceneMatchVersion init param)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@935739 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2010-04-19 20:56:35 +00:00
parent a95a785c74
commit 8f1313564a
2 changed files with 3 additions and 1 deletions

View File

@ -25,7 +25,8 @@ import org.apache.lucene.analysis.TokenStream;
/** Factory for {@link ThaiWordFilter} */ /** Factory for {@link ThaiWordFilter} */
public class ThaiWordFilterFactory extends BaseTokenFilterFactory { public class ThaiWordFilterFactory extends BaseTokenFilterFactory {
public ThaiWordFilter create(TokenStream input) { public ThaiWordFilter create(TokenStream input) {
return new ThaiWordFilter(input); assureMatchVersion();
return new ThaiWordFilter(luceneMatchVersion, input);
} }
} }

View File

@ -35,6 +35,7 @@ public class TestThaiWordFilterFactory extends BaseTokenTestCase {
Reader reader = new StringReader("การที่ได้ต้องแสดงว่างานดี"); Reader reader = new StringReader("การที่ได้ต้องแสดงว่างานดี");
Tokenizer tokenizer = new WhitespaceTokenizer(DEFAULT_VERSION, reader); Tokenizer tokenizer = new WhitespaceTokenizer(DEFAULT_VERSION, reader);
ThaiWordFilterFactory factory = new ThaiWordFilterFactory(); ThaiWordFilterFactory factory = new ThaiWordFilterFactory();
factory.init(DEFAULT_VERSION_PARAM);
TokenStream stream = factory.create(tokenizer); TokenStream stream = factory.create(tokenizer);
assertTokenStreamContents(stream, new String[] {"การ", "ที่", "ได้", assertTokenStreamContents(stream, new String[] {"การ", "ที่", "ได้",
"ต้อง", "แสดง", "ว่า", "งาน", "ดี"}); "ต้อง", "แสดง", "ว่า", "งาน", "ดี"});