Skip to content

feature request: Bring back the dovecot-solr package #4052

@erm967

Description

@erm967

Please re-enable the solr plugin it is 1000 times better than xapian that keeps failing and uses way too much memory.

It's possible to use solr9 that was updated 2 days ago and supports both arm64 and amd64, however it requires some work and it is not well described in dovecot documentation. I can write a better documentation if you need it.

The steps are:

docker compose start solr (or up -d)
docker compose exec solr create -c dovecot

The dovecot database can be created also in the compose file like this:

  solr:
    image: solr:latest
    container_name: solr
    volumes:
      - /path/to/solr-dovecot:/var/solr
    networks:
      - backend
    command:
      - solr-precreate
      - dovecot
    restart: always

Start it once than stop it: docker compose stop solr

Copy the schema file overwriting existing ones:

rm -f /path/to/solr-dovecot/data/dovecot/conf/schema.xml
rm -f /path/to/solr-dovecot/data/dovecot/conf/managed-schema
rm -f /path/to/solr-dovecot/data/dovecot/conf/solrconfig.xml

Download the correct schema from github:

curl -o /path/to/solr-dovecot/data/dovecot/conf/schema.xml https://github.com/dovecot/core/raw/a9cbc569ad0d3d827d81bf954088987b2de1d27c/doc/solr-schema-9.xml
curl -o /path/to/solr-dovecot/data/dovecot/conf/solrconfig.xml 
  https://github.com/dovecot/core/raw/a9cbc569ad0d3d827d81bf954088987b2de1d27c/doc/solr-config-9.xml

The dovecot scheme requires the ICU plugin but the scheme in the dovecot repo references to an old version so solrconfig.xml needs to be patched like this:

--- /var/data/dms/config/dovecot/solr-dovecot/data/dovecot/conf/solrconfig.xml	2024-05-03 15:55:51.708712626 +0200
+++ solr-config-9.xml	2024-06-06 18:26:52.543138695 +0200
@@ -76,7 +76,7 @@
 
     <!-- Load ICU analyser -->
     <lib dir="/opt/solr/modules/analysis-extras/lib" regex="icu4j-70.1.jar"/>
-    <lib dir="/opt/solr/modules/analysis-extras/lib" regex="lucene-analysis-icu-9.10.0.jar"/>
+    <lib dir="/opt/solr/modules/analysis-extras/lib" regex="lucene-analysis-icu-9.8.0.jar"/>
   <!-- an exact 'path' can be used instead of a 'dir' to specify a
        specific jar file.  This will cause a serious error to be logged
        if it can't be loaded.

Using solr9 works perfectly the only complication is the patch to solrconfig.xml so that it refers to the current library version.

Originally posted by @erm967 in #4024 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions