Skip to content

search: indexing never removes facet metadata it no longer extracts #3677

Closed

Description

@dschmidt

Describe the bug

Indexing writes the facets it extracted into the resource's arbitrary metadata (libre.graph.photo.*, .audio.*, .image.*, .video.*, .location.*, .motionPhoto.*, .livePhoto.*), and PROPFIND serves them from there. The write merges, so a value the extraction no longer produces stays on the resource, and re-indexing never removes it.

Steps to reproduce

  1. Upload a photo that carries EXIF and let it be indexed. PROPFIND shows oc:camera-make, oc:camera-model, oc:iso, oc:f-number, oc:taken-date-time.
  2. Strip the metadata from that file (magick in.jpg -strip out.jpg) and upload it over the same name, which indexes it again.
  3. PROPFIND the file.

Expected behavior

The facets the file no longer carries are gone from the resource.

Actual behavior

All of them are still served, with the values from the first upload.

Setup

doUpsertItem collects the facets the current extraction produced and hands them to SetArbitraryMetadata, which merges rather than replaces. A facet that vanished entirely does not even get that far:

if len(metadata) == 0 {
    return
}

The indexer owns a known key space, the seven prefixes and the fields of their libregraph models, so it could unset the owned keys it did not just write. Worth deciding: whether unset and set should be one call so no reader sees a half updated facet, and whether keys already written need a migration or are cleaned on the next index after the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions