- Home
- Documentation
- Howtos

# Creating and using multiple indexes

## Why would you want to do this ?

- Easy adjustment of search areas: you can filter results by using the directory filter in the advanced search panel, but, if you have separate well defined places where you store different kind of data, it is easier to maintain separate index and use the External indexes dialog to switch them on or off, and it will also yield much better search performance.
- Shared indexes: it may be useful to maintain one or several indexes for shared data, and separate personal indexes for each user.

## How to do it

As an example we'll suppose that you have Recoll installed and indexing your home directory, and that you would like to have a separate index for `/usr/shared/doc`.

You need to create a separate configuration for the new index, then add it to the external indexes list in the user interface, and activate it as needed.

1. Create a directory for the new index:

       cd
       mkdir .recoll-sharedoc

2. Create a minimal configuration file:

       cd .recoll-sharedoc
       echo "topdirs = /usr/share/doc" > recoll.conf

3. Perform initial indexing:

       recollindex -c ~/.recoll-sharedoc

4. Optionally set up cron to perform nightly indexing, use

       crontab -e

   and insert a line like the following:

       45 20 * * * recollindex -c ~/.recoll-sharedoc

   This would start the indexing at 20:45. `crontab -e` will use the `vi` editor by default, you can change this by using the `EDITOR` environment variable. Exemple:

       EDITOR=kate crontab -e

   Your favorite desktop may also have a dedicated tool to add `crontab` entries.
5. Start `recoll` and choose the Preferences->External index dialog menu entry, then click the Browse button (near the bottom), and select the new index Xapian database directory:

       ~/.recoll-sharedoc/xapiandb

   Then click Add index.
6. You can then activate or deactivate the new index by clicking the box in front of the directory name in the list.

When adding an index shared by multiple users, it may be helpful to use the `RECOLL_EXTRA_DBS` environment variable instead of editing individual configurations, see the manual for more details.