Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching for images in a certain time range does not produce desired images #15151

Open
1 of 3 tasks
nielstron opened this issue Jan 7, 2025 · 5 comments
Open
1 of 3 tasks

Comments

@nielstron
Copy link

The bug

When using the search to select images taken between 1/1/2018 and 1/1/2019, the search shows no result

image

However, when I navigate to some month in 2018, I clearly find images in immich that are taken in this time range.

image

This behaviour is either very unintuitive or buggy.

The OS that Immich Server is running on

Ubuntu 24.04

Version of Immich Server

v1.124.0

Version of Immich Mobile App

latest

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - /mnt/storage_box:/mnt/storage_box
      - ${ENCODED_VIDEO_LOCATION}:/usr/src/app/upload/encoded-video
      - ${THUMB_LOCATION}:/usr/src/app/upload/thumbs
    env_file:
      - .env
    ports:
      - 2283:2283
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:e3b17ba9479deec4b7d1eeec1548a253acc5374d68d3b27937fcfe4df8d18c7e
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-align --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_interval: 30s
      start_period: 5m
    command: ["postgres", "-c", "shared_preload_libraries=vectors.so", "-c", 'search_path="$$user", public, vectors', "-c", "logging_collector=on", "-c", "max_wal_size=2GB", "-c", "shared_buffers=512MB", "-c", "wal_compression=on"]
    restart: always

volumes:
  model-cache:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your database files are stored
DB_DATA_LOCATION=./postgres
# The location where your uploaded files are stored
UPLOAD_LOCATION=/mnt/storage_box/library
# The location where re-encoded videos are stored
ENCODED_VIDEO_LOCATION=/mnt/storage_box/encoded-video
THUMB_LOCATION=/root/immich-app/library/thumbs
PROFILE_LOCATION=/root/immich-app/library/profile

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=Europe/Berlin

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION="v1.124.0"

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=***********************

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=*********
DB_DATABASE_NAME=**********

# increase timeout for machine learning
MACHINE_LEARNING_WORKER_TIMEOUT=600
MACHINE_LEARNING_WORKERS=1

Reproduction steps

  1. Upload a ton of images into immich
  2. Select a date range
  3. Don't find expected images

Relevant log output

No response

Additional information

All images are in external storage. My other users also report that images without date tag are mixed into ranges incorrectly though I could not reproduce this bevhaviour in my account so far.

@bo0tzz
Copy link
Member

bo0tzz commented Jan 8, 2025

Can you please post:

  1. The log (with the log level set to verbose) from when you run this search
  2. The JSON data of one of these assets (open it, then replace /photos/ in the url with /api/assets)
  3. More detail on whether/how you're using (partner) sharing etc

@nielstron
Copy link
Author

Server log during the request:

[Nest] 17  - 01/09/2025, 9:06:14 AM   DEBUG [Api:LoggingInterceptor~94ezi0zr] GET /api/people/f67e0871-8845-4d44-836e-5ba9955cd161/thumbnail?updatedAt=2024-09-12T07%3A38%3A11.948Z 304 5.83ms 79.251.11.167
[Nest] 17  - 01/09/2025, 9:06:17 AM   DEBUG [Api:LoggingInterceptor~ssjbqzs7] GET /api/server/ping 200 0.39ms ::ffff:127.0.0.1
[Nest] 17  - 01/09/2025, 9:06:24 AM   DEBUG [Api:LoggingInterceptor~toocgj5l] POST /api/search/metadata 200 12.59ms 79.251.11.167
[Nest] 17  - 01/09/2025, 9:06:24 AM VERBOSE [Api:LoggingInterceptor~toocgj5l] {"page":1,"withExif":true,"isVisible":true,"takenAfter":"2018-01-01T00:00:00.000Z","takenBefore":"2019-01-01T23:59:59.999Z"}

JSON data of one of the assets:

{"id":"7051f2f1-d839-4169-bdd3-01a50dbcc094","deviceAssetId":"IMG-20181011-WA0008.jpg","ownerId":"93f6ab6a-565c-45d3-9d88-8507085f4aff","owner":{"id":"93f6ab6a-565c-45d3-9d88-8507085f4aff","email":"***","name":"niels","profileImagePath":"","avatarColor":"yellow","profileChangedAt":"2024-09-28T15:56:42.823Z"},"deviceId":"Library Import","libraryId":"5d0bcee6-431c-487d-8b9b-b2a2d4fb6562","type":"IMAGE","originalPath":"/mnt/storage_box/niels-backup/Backup/Pictures/***/2018.06.07/WhatsApp Images/Sent/IMG-20181011-WA0008.jpg","originalFileName":"IMG-20181011-WA0008.jpg","originalMimeType":"image/jpeg","thumbhash":"9vcJDACXyHgHiI0H6BiYg4A5CA==","fileCreatedAt":"2024-09-08T01:18:03.000Z","fileModifiedAt":"2024-09-08T01:18:03.000Z","localDateTime":"2018-10-10T22:00:00.000Z","updatedAt":"2024-11-08T15:15:10.164Z","isFavorite":false,"isArchived":false,"isTrashed":false,"duration":"0:00:00.00000","exifInfo":{"make":null,"model":null,"exifImageWidth":899,"exifImageHeight":1599,"fileSizeInByte":164066,"orientation":null,"dateTimeOriginal":"2018-10-10T22:00:00.000Z","modifyDate":"2024-09-08T01:18:03.000Z","timeZone":null,"lensModel":null,"fNumber":null,"focalLength":null,"iso":null,"exposureTime":null,"latitude":null,"longitude":null,"city":null,"state":null,"country":null,"description":"","projectionType":null,"rating":null},"livePhotoVideoId":null,"tags":[],"people":[],"unassignedFaces":[],"checksum":"3bjQU2x5HUHb9NBp2TEgYEIFX+0=","stack":null,"isOffline":false,"hasMetadata":true,"duplicateId":null,"resized":true}

Partner/sharing:
I don't use sharing or partner sharing, all images are stored in external storage.

@nielstron
Copy link
Author

nielstron commented Jan 9, 2025

Maybe unrelated, but a search for "takenAfter" translates it to a "fileCreatedAt" constraint in a db search

fileCreatedAt: OptionalBetween(options.takenAfter, options.takenBefore),

I guess this is swapped with "createdAfter" which is translated to "createdAt", which I assume from the context to refer to when the image was taken, but more likely "createdAfter" refers to the file creation date

createdAt: OptionalBetween(options.createdAfter, options.createdBefore),

This would not be noticed on setups where the two dates coincide, which is quite frequently the case and only not the case for older images transferred from another system.

@alextran1502
Copy link
Contributor

Can you post some of the assets from the screenshot above so we can reproduce and troubleshoot? Please zip them up when you do, thank you!

@nielstron
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants