Skip to content

search field in the media table does not update when adding tags until the second edit #1207

@borisaguilar

Description

@borisaguilar

When editing a media item and adding tags, the tags are correctly saved in the database. However, the search field in the media table is not updated immediately, causing the new tags to be excluded from text searches.

Steps to reproduce:

Edit an existing media item.
Add one or more tags.
Save the changes.
Try searching for the media item using the newly added tags → It does not appear in search results.
Edit the same media item again without making any changes and save.
Try searching for the media item using the tags → Now it appears in search results.

Expected behavior:

The search field in the media table should update immediately when adding tags, without requiring a second edit and save action.

Possible cause:

It seems that the SearchVectorField is not being updated when new tags are added during the first edit. This could be due to the search index not including tags in its update process or the signal responsible for updating the index not triggering properly.

Environment:

MediaCMS version: 4.4.1
Installation method: Docker
Additional notes:

I've tried fixing it myself by editing the file: /files/views.py @ line 205:

# Force refresh the search index for this media
media.save(update_fields=['search'])

But didn't seem to fix it (I don't have much experience with SearchVectorField)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions