| 1 |
.. _imapinstall-xapian: |
| 2 |
|
| 3 |
==================== |
| 4 |
Xapian for searching |
| 5 |
==================== |
| 6 |
|
| 7 |
Cyrus can be configured to use `Xapian <http://xapian.org>`_ to power its searches. |
| 8 |
|
| 9 |
Compiling Xapian for Cyrus |
| 10 |
========================== |
| 11 |
|
| 12 |
.. note:: |
| 13 |
|
| 14 |
If CJK support is not required in your environment, you can use Cyrus with a |
| 15 |
standard upstream Xapian 1.4 release. Skip this section and move straight on to |
| 16 |
:ref:`Configuring Xapian <configuring-xapian>`. If you need CJK support, you will |
| 17 |
still need to use the cyruslibs Xapian fork and compile from source. |
| 18 |
|
| 19 |
The cyrusimap/cyruslibs repository provides a pre-patched copy of 1.5-dev Xapian, ready for use with Cyrus. We are working on having the patches integrated upstream. |
| 20 |
|
| 21 |
Compiling Xapian requires gcc 4.9 or later. |
| 22 |
|
| 23 |
To build Xapian, fetch the cyruslibs package which comes with pre-patched Xapian and some other |
| 24 |
dependencies. They are installed in ``/usr/local/cyruslibs`` by default unless overridden on the |
| 25 |
command line. |
| 26 |
|
| 27 |
.. code-block:: bash |
| 28 |
|
| 29 |
export CYRUSLIBS="/usr/local/cyruslibs" |
| 30 |
export PKG_CONFIG_PATH="$CYRUSLIBS/lib/pkgconfig:$PKG_CONFIG_PATH" |
| 31 |
export LDFLAGS="-Wl,-rpath,$CYRUSLIBS/lib -Wl,-rpath,$CYRUSLIBS/lib/x86_64-linux-gnu" |
| 32 |
export PATH="$PATH:$CYRUSLIBS/bin" |
| 33 |
|
| 34 |
git clone [email protected]:cyrusimap/cyruslibs.git |
| 35 |
cd cyruslibs |
| 36 |
sh build.sh $CYRUSLIBS_DIR |
| 37 |
|
| 38 |
Then follow on with the Cyrus :ref:`compilation instructions <compiling>`, adding ``--enable-xapian`` to the flags to ``./configure``. |
| 39 |
|
| 40 |
Additional dependencies required for Cyrus with Xapian support |
| 41 |
============================================================== |
| 42 |
|
| 43 |
When building Cyrus with Xapian support enabled, the following additional |
| 44 |
packages are required: |
| 45 |
|
| 46 |
* `rsync <https://rsync.samba.org>`_ (used when compacting databases) |
| 47 |
|
| 48 |
.. _configuring-xapian: |
| 49 |
|
| 50 |
Configuring Xapian |
| 51 |
================== |
| 52 |
|
| 53 |
Xapian requires a running :cyrusman:`squatter(8)` instance: |
| 54 |
|
| 55 |
* In :cyrusman:`cyrus.conf(5)` set up a daemon squatter to run: :: |
| 56 |
|
| 57 |
DAEMON { |
| 58 |
# run a rolling squatter |
| 59 |
squatter cmd="squatter -R" |
| 60 |
} |
| 61 |
|
| 62 |
* Enable sync logging: Set ``sync_log: on`` in :cyrusman:`imapd.conf(5)`. |
| 63 |
* Add a squatter sync log channel: ``sync_log_channels: squatter`` in :cyrusman:`imapd.conf(5)`. |
| 64 |
|
| 65 |
You also need (at least one) search tier. Add this to :cyrusman:`imapd.conf(5)`. |
| 66 |
|
| 67 |
:: |
| 68 |
|
| 69 |
search_engine: xapian |
| 70 |
search_index_headers: no |
| 71 |
search_batchsize: 8192 |
| 72 |
defaultpartition: base |
| 73 |
defaultsearchtier: t1 |
| 74 |
partition-base: /var/cyrus/spool |
| 75 |
t1searchpartition-base: /var/cyrus/search |
| 76 |
|
| 77 |
If you want to do more complex search tiers and repacking, you'll want to read: |
| 78 |
|
| 79 |
http://lists.tartarus.org/pipermail/xapian-discuss/2014-October/009112.html |