When developing a text analysis plug-in, need to read and write dic directory:
package com.lietu.bigramSeg;
import org.apache.lucene.analysis.Tokenizer;
import org.elasticsearch.plugin.analysis.TokenizerFactory;
import org.apache.lucene.util.AttributeFactory;
import org.elasticsearch.plugin.NamedComponent;
@NamedComponent(value = "cn_tokenizer")
public class BigramTokenizerFactory implements TokenizerFactory {
@Override
public Tokenizer create() {
AttributeFactory factory = AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY;
String dicPath = "./dic/";
BigramDictioanryPrev dict = BigramDictioanryPrev.getInstance(dicPath);
return new NgramTokenizer(factory, dict);
}
}
When using this plug-in, elasticsearch output error:
[2025-02-05T14:17:53,025][WARN ][stderr ] [DESKTOP-GS2A859] java.security.AccessControlException: access denied ("java.io.FilePermission" ".\dic\ArrayNodeInfofile.dat" "read")