Live Indexing and new files

I recently installed all the Full Text Search apps and I am delighted to see that it has fine grain options that the old Nextant didn’t have.

The only thing I don’t understand is the Live Indexing option. If I don’t activate it, will Full text search index new files? Or you have to run the ```
/occ fulltextsearch:index

No, you don’t. occ fulltextsearch:index would crawl your whole file base again.

If files are uploaded or changed they will be ‘registered’ as some kind of ‘to be indexed’, and the next cron job will index them.

occ fulltextsearch:live is meant for very busy sites where the cron interval is too long (a lot of changed files would be accumulated in 15 minutes). This is a permanently running job that acts immediately when a file is changed or uploaded. On a rather small instance you certainly don’t need it, or you could even shorten the cron interval. On my private site with 5 users, i have set the cron interval to one minute without any negative impact.

1 Like

It appears in the latest Nextcloud docker container (ver 17) the cron.php doesn’t manage this. I have to run a host level fulltextsearch:live service (systemctl) on the host OS or cron job on the host OS that runs fulltextsearch:index. I am doing the former as that seems the most efficient. Most other posts in the forum seem to make the assumption the cronjob will manage this.

same here when i upload a new file wait for one hour and search for the file with the search function it does not detect the file.
But once I run the “occ fulltextsearch:live” command directly it does detect the file and I can find it with the search fuction.
NC 19.
Does someone else has this problem?

1 Like

Hey folks,

I’d like to share my solution to that. I make use of a separate container taking care of cron type jobs. That way I neither have to hack around with my docker host nor do I have to build my own hacky nextcloud image with cron stuff.

It is based on this: GitHub - willfarrell/docker-crontab: A docker job scheduler (aka. crontab for docker)

I encounter an issue with running the command as www-data user but found a working solution, for details see: Feature Request: run docker task as a different user · Issue #50 · willfarrell/docker-crontab · GitHub

Please find my docker compose file for that and my config for the fulltextsearch:index job below.

I hope that this will help others too.

JJ

# # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Content: crontab 
# Author: Jan Jambor
# Author URI: https://xwr.ch
#
# Required variables:
# - ${CT_DATA_BASEPATH}
#
# # # # # # # # # # # # # # # # # # # # # # # # # #

version: "3.8"

services:
  crontab:
    # https://hub.docker.com/r/willfarrell/crontab/tags
    container_name: crontab
    hostname: crontab
    image: willfarrell/crontab:1.0.0
    restart: unless-stopped
    volumes:
      - '/var/run/docker.sock:/var/run/docker.sock:ro'
      - '${CT_DATA_BASEPATH}/crontab/config/crontab_config.yml:/opt/crontab/config.yml:rw'
      - '${CT_DATA_BASEPATH}/crontab/logs:/var/log/crontab:rw'
    logging:
      driver: "json-file"
      options:
        tag: "{{.ImageName}}|{{.Name}}|{{.ImageFullID}}|{{.FullID}}"
    networks:
      - DockerLAN

networks:
  DockerLAN:
    external:
      name: DockerLAN

config.yml:

- name: nextcloud-fulltext
  command: docker exec -u www-data nextcloud php occ fulltextsearch:index
  comment: re-indexing nextcloud fulltext search for documents
  container: crontab
  schedule: '30  1 * * *'

Wouldn’t this re-scan the whole instance every night?