Setup

  • Solr version: 9.8
  • Drupal Core version: 10.4.2
  • Search API version: 1.37.0
  • Search API Solr version: 4.3.7
  • Configured Solr Connector: basic_auth

Issue

Solr 9.8 introduced a braking change: <lib/> directives in solrconfig.xml have been made into an "opt-in" feature. This can cause Solr to fail if not addressed on Solr instance, as the solrconfig.xml provided by this module both contains and relies on <lib/> directives.

Solr 10 plans to remove the <lib/>-directive entirely:

<lib/> directives are deprecated and will be removed in Solr 10.0. In the interim, Solr disables this feature by default in order to minimize the security exposure of our users. Expert users who wish to enable <lib/> directives in their deployment may do so by specifying setting the solr.config.lib.enabled sysprop to true.

Solr will produce both a silent warning:

Configset references one or more <lib/> directives, but <lib/> usage is disabled on this Solr node. Either remove all <lib/> tags from the relevant configset, or enable use of this feature by setting 'solr.config.lib.enabled=true'

and, if not mitigated, a error:

Can't load schema /var/solr/data/defaultcore/conf/schema.xml: Plugin init failure for [schema.xml] fieldType "collated_de": Error loading class 'solr.ICUCollationField'

Possible solutions

As solutions must be implemented on the Solr-Instance itself, there is not much this project can do other than inform Users about these changes and suggest possible solutions. Possible solutions are:

  • Setting solr.config.lib.enabled=true, as suggested by Solr's error messages. This can be achieved, for example, by setting SOLR_OPTS="$SOLR_OPTS -Dsolr.config.lib.enabled=true" in solr.in.sh
  • Installing the required modules globally. In a container for example, setting the environment variable SOLR_MODULES=extraction,langid,ltr,analysis-extras will work.


  • Im not sure myself what the best way to do this is, and under what circumstances adding solr.config.lib.enabled=true is a good idea, so I would appreciate feedback on this before writing stuff in the documentation.

    Further Resources:

    Comments

    robincs created an issue. See original summary.

    robincs’s picture

    Also, thanks to @znerol for suggesting these solutions in another issue.

    vannergard’s picture

    Hmm, which libs are part of the default configuration for Search API Solr?

    It feels like a list of what needs to be configured or allowed is best.

    I do notice in the change announcement that this change is due to multiple security issues, so it does sound like a general enable might not be the best choice?

    mkalkbrenner’s picture

    The lib includes for Solr 9 could be seen here:
    https://git.drupalcode.org/project/search_api_solr/-/blob/4.x/solr-conf-...

    Basically we include the required stuff for some aditional features per default:

    • extraction to parse PDFs
    • langid and analysis-extras for special languages that aren't English
    • ltr for the LearnToRank feature

    There's a pending feature request to load more advanced libs for spatial search.

    In general, the config-sets provided by this module are defaults which have to be adjusted to your use-case. A lot of things are already configurable. But you can also use an EventSubsriber to do further modifications.
    But we can't do anything about what needs to be configured in the Solr server itself.

    So having a doumentation would be great. In the README and the online handbook.
    Also, a patch that adds information to the UI of search_api_solr is welcome.

    mkalkbrenner’s picture

    Version: 4.3.7 » 4.x-dev
    Category: Bug report » Task

    • mkalkbrenner committed e81d0ade on 4.x
      Issue #3505915 by robincs, mkalkbrenner: <lib/> directives have been...
    mkalkbrenner’s picture

    Status: Active » Fixed

    Status: Fixed » Closed (fixed)

    Automatically closed - issue fixed for 2 weeks with no activity.