mirror of https://github.com/apache/lucene.git
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:
parent
a95a785c74
commit
8f1313564a
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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[] {"การ", "ที่", "ได้",
|
||||||
"ต้อง", "แสดง", "ว่า", "งาน", "ดี"});
|
"ต้อง", "แสดง", "ว่า", "งาน", "ดี"});
|
||||||
|
|
Loading…
Reference in New Issue