问题
I have error when using Apache OpenNLP with Solr (ver. 7.3.0) in Cloud mode. When I add field type to managed-schema using open nlp like this:
<fieldType name="text_opennlp" class="solr.TextField">
<analyzer>
<tokenizer class="solr.OpenNLPTokenizerFactory"
sentenceModel="opennlp/en-sent.bin"
tokenizerModel="opennlp/en-token.bin"
/>
</analyzer>
</fieldType>
<field name="content" type="text_opennlp" indexed="true" termOffsets="true" stored="true" termPayloads="true" termPositions="true" docValues="false" termVectors="true" multiValued="true" required="true"/>
and I have following error:
test_collection_shard1_replica_n1: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core test_collection_shard1_replica_n1: Can't load schema managed-schema: org.apache.solr.core.SolrResourceNotFoundException: Can't find resource 'opennlp/en-sent.bin' in classpath or '/configs/_default', cwd=D:\utils\solr-7.3.0-7\solr-7.3.0-7\server Please check your logs for more information
I have downloaded solr var 7.3.0-7 from https://builds.apache.org/job/Solr-Artifacts-7.3/lastSuccessfulBuild/artifact/solr/package/
I tried to put model files to: D:\utils\solr-7.3.0-7\solr-7.3.0-7\server
but it didn't help.
Here you are my related question: Can not apply patch LUCENE-2899.patch to SOLR on Windows
Maybe I need to put model files somewhere else?
回答1:
You need to put those files ("en-sent.bin"
and the other one) into core's conf directory.
That is D:\utils\solr-7.3.0-7\solr-7.3.0-7\server\{core_name}\conf
.
Then use the files directly. Following should be the xml configuration.
<tokenizer class="solr.OpenNLPTokenizerFactory"
sentenceModel="en-sent.bin"
tokenizerModel="en-token.bin"
/>
来源:https://stackoverflow.com/questions/49507004/solrcloud-opennlp-error-cant-find-resource-opennlp-en-sent-bin-in-classpath-o