1 package org.apache.lucene.analysis.ru; 2 3 18 19 import org.apache.lucene.analysis.TokenFilter; 20 import org.apache.lucene.analysis.Token; 21 import org.apache.lucene.analysis.TokenStream; 22 23 29 public final class RussianLowerCaseFilter extends TokenFilter 30 { 31 char[] charset; 32 33 public RussianLowerCaseFilter(TokenStream in, char[] charset) 34 { 35 super(in); 36 this.charset = charset; 37 } 38 39 public final Token next() throws java.io.IOException 40 { 41 Token t = input.next(); 42 43 if (t == null) 44 return null; 45 46 String txt = t.termText(); 47 48 char[] chArray = txt.toCharArray(); 49 for (int i = 0; i < chArray.length; i++) 50 { 51 chArray[i] = RussianCharsets.toLowerCase(chArray[i], charset); 52 } 53 54 String newTxt = new String (chArray); 55 Token newToken = new Token(newTxt, t.startOffset(), t.endOffset()); 57 58 return newToken; 59 } 60 } 61 | Popular Tags |