3
votes

I've implemented a custom Solr filter. I want to use it with Solr in cloud mode. I followed the official instruction for adding plugins in cloud mode (that can be found here: https://lucene.apache.org/solr/guide/7_5/adding-custom-plugins-in-solrcloud-mode.html), however it failed to apply the configuration.

The filter and its factory class have been implemented, JAR created. JAR size is tiny (couple of kbs). Solr run with runtime libs enabled (solr start -c -Denable.runtime.lib=true). JAR was uploaded into .system collection. Confirmed by a query. Mock test collection "mycollection" created. BLOB with custom filter registered within test collection. Custom filter added to a particular fieldType ("title_string") in the "schema.xml" with parameter runtimeLib="true". Configuration loaded.

I tried to search for the instructions and found that there were problems to run any modules defined in schema.xml (such as a filter). I followed the same procedure with a custom queryParser plugin (they are defined in solrconfig.xml) and it worked fine in cloud mode. Solr version is 7.7.2.

schema.xml fieldType that uses custom filter:

<fieldType name="title_string" class="solr.TextField" multiValued="false">
  <analyzer>
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="com.mycompany.filters.SimpleFilterFactory" runtimeLib="true" version="1"/>
  </analyzer>
</fieldType>

Error thrown by Solr (logs) after I applied the configuration:

mycollection_shard1_replica_n1: org.apache.solr.common.SolrException:org.apache.solr.common.SolrException: Could not load conf for core mycollection_shard1_replica_n1: Can't load schema schema.xml: Plugin init failure for [schema.xml] fieldType "title_string": Plugin init failure for [schema.xml] analyzer/filter: Error loading class 'com.mycompany.filters.SimpleFilterFactory'

1

1 Answers

0
votes

Based on this issue: https://issues.apache.org/jira/browse/SOLR-9175

Currently, only solrconfig.xml support loading custom classes from the Blob Store, and custom analyzers which are defined in schema.xml cannot be used for now.

A workaround is to put the jar file in each Solr installation of the SolrCloud.

You can put them under SOLR_HOME/lib-- see detail