Indexer

Starting from version 0.22, AFFiNE supports server-side indexer. After the release of the version 0.23, you will be able to enable the server-side full-text search feature on the AFFiNE client.

We add manticoresearch/manticore:10.1.0 to support the server-side indexer and full-text search.

Preparation

Backup data

  • Perform a full backup of the PostgreSQL database to ensure data can be recovered in case of issues during the upgrade. Learn how to do the backup.

Stop existing services

  • Stop running services using the Docker Compose command:
docker compose -f docker-compose.yml down
  • Confirm that all relevant containers have stopped running to avoid data write conflicts.

Enable indexer

Using the Docker Compose script we provide and self-deployment.

Adddocker-compose.indexer.yml file

In the directory where the docker-compose.yml file is located, create a new file named docker-compose.indexer.yml and add the following content:

docker-compose.indexer.yml
services:
  affine:
    depends_on:
      indexer:
        condition: service_healthy
    environment:
      - AFFINE_INDEXER_ENABLED=true
      - AFFINE_INDEXER_SEARCH_ENDPOINT=http://indexer:9308

  affine_migration:
    depends_on:
      indexer:
        condition: service_healthy
    environment:
      - AFFINE_INDEXER_ENABLED=true
      - AFFINE_INDEXER_SEARCH_ENDPOINT=http://indexer:9308

  indexer:
    image: manticoresearch/manticore:${MANTICORE_VERSION:-10.1.0}
    container_name: affine_indexer
    volumes:
      - ${MANTICORE_DATA_LOCATION}:/var/lib/manticore
    ulimits:
      nproc: 65535
      nofile:
        soft: 65535
        hard: 65535
      memlock:
        soft: -1
        hard: -1
    healthcheck:
      test:
        ['CMD', 'wget', '-O-', 'http://127.0.0.1:9308']
      interval: 10s
      timeout: 5s
      retries: 5
    restart: unless-stopped

Update exists.env file

Add new MANTICORE_DATA_LOCATION env to your exists .env file

.env
# ... exists content

# The folder for manticore data, usually to be the one in step with '/manticore' suffix 
MANTICORE_DATA_LOCATION=./manticore 

Pull the new image and start the services

Start with docker-compose.yml and docker-compose.indexer.yml both

# pull the latest image
docker compose -f docker-compose.yml -f docker-compose.indexer.yml pull
# start services
docker compose -f docker-compose.yml -f docker-compose.indexer.yml up -d