How to import attribute from another analyzer plugin

I'm attempting to create custom token filter in elasticsearch (7.8.0, lucene 8.5.1).
I managed to make my own plugin with filter, installed on my ES cluster.
In this filter, I'm trying to use attribute from another analyzer plugin which is Nori and having a bit of trouble.

import org.apache.lucene.analysis.ko.tokenattributes.PartOfSpeechAttribute;
public class MyFilter extends TokenFilter {
    private final PartOfSpeechAttribute posAtt = addAttribute(PartOfSpeechAttribute.class);

This code gives me "java.lang.NoClassDefFoundError: org/apache/lucene/analysis/ko/tokenattributes/PartOfSpeechAttribute" when I try to add index with MyFilter settings.

I tried using fat jar (org.apache.lucene:lucene-analyzers-nori:8.5.1 included in MyFilter.jar) but same error occurred.

Any idea or piece of comment should help me greatly.
Thanks in advance! :slight_smile:

I found solution and write here for anyone in need.

The only way to use PartOfSpeechAttribute.class set from nori-tokenizer is to add filter inside nori-analyzer so that nori-tokenizer and custom-filter is in same package & jar.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.