I am trying to implement a custom solr filter to stem arabic word, the filter class is as follow but i keep getting the following error "possible analysis error" when indexing the document, i am using Khoja's stemmer
public final class CustomArbicStemFilter extends TokenFilter {
private CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
private CustomArabicStemmer stemmer = null;
public CustomArbicStemFilter(TokenStream input) {
super(input);
this.stemmer = new CustomArabicStemmer();
}
public final boolean incrementToken() throws IOException {
if (input.incrementToken()) {
char termBuffer[] = termAtt.buffer();
String currentWord = new String( termBuffer);
String stemmedWord = stemmer.stemWord(currentWord);
char finalTerm[] = stemmedWord.toCharArray();
termAtt.copyBuffer(finalTerm, 0, finalTerm.length);
return true;
}else{
return false;
}
} }