Bug 485157 - Filter for Color or Pick Labels can not be activated.
Summary: Filter for Color or Pick Labels can not be activated.
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-Filters (show other bugs)
Version: 8.3.0
Platform: Debian stable Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-06 22:51 UTC by Christoph Scheurer
Modified: 2024-04-08 07:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 8.4.0
Sentry Crash Report:


Attachments
Screenshot of the situation (183.95 KB, image/png)
2024-04-07 05:51 UTC, Christoph Scheurer
Details
Debug log (36.84 KB, text/plain)
2024-04-07 06:06 UTC, Christoph Scheurer
Details
Debug log with digiKam-8.4.0-20240407T113137-x86-64-debug.appimage (60.37 KB, text/plain)
2024-04-07 12:33 UTC, Christoph Scheurer
Details
tagstable.png (110.10 KB, image/png)
2024-04-07 16:14 UTC, Maik Qualmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Scheurer 2024-04-06 22:51:23 UTC
SUMMARY
Color and pick filters seem not to work. Filtering on all other fields (e.g. rating, file format, text tags etc.) works flawlessly.

STEPS TO REPRODUCE
1. Mark an image with a color tag, e.g. "orange".
2. Activate color filter to show only images with tag "orange".

OBSERVED RESULT
The tagged image has an orange frame (as expected) but all other thumbnails are also still visible (unexpected) when the color filter is activated.

EXPECTED RESULT
Only the appropriately tagged thumbnails according to the filter setting should be shown and the message at the bottom of the window should show that the filter was applied.

SOFTWARE VERSIONS
This was tested on Debian stable with the AppImage versions 8.2.0 and 8.3.0 as well as with a self-compiled 8.3.0.

ADDITIONAL INFORMATION
I have also switched between sqlite and MariaDB as databases to exclude these as a source of this behaviour. The filtering on the color or pick tags used to work as expected with an older version of digikam.
Comment 1 Maik Qualmann 2024-04-07 05:42:02 UTC
I cannot reproduce the problem here, neither with the current AppImage (Qt5) nor with my native developer version (Qt6).
I have no idea at the moment what could be causing this.

Please create a debug log from start to setting a filter from the digiKam debug messages in the terminal.
Maybe we can see a possible cause in the log.

https://www.digikam.org/contribute/

Maik
Comment 2 Christoph Scheurer 2024-04-07 05:51:37 UTC
Created attachment 168237 [details]
Screenshot of the situation

Thanks for the quick response! I will generate a log as requested.
This is a screenshot of the UI showing the problem I am facing.
Comment 3 Christoph Scheurer 2024-04-07 06:06:54 UTC
Created attachment 168238 [details]
Debug log

The debug.log attachment was created in the following way:
1. export QT_LOGGING_RULES="digikam*=true"
2. /usr/bin/digikam > /tmp/debug.log 2>&1 &
3. digikam opened with the test album from the screenshot
4. the "orange" filter was toggled twice - no output in the log
5. changed album (to see any log output) and toggled filter
6. returned to the album from the screenshot
7. toggle "orange" filter several times
8. quit digikam
Comment 4 Maik Qualmann 2024-04-07 06:56:17 UTC
Git commit 0cb8f4a999dc48fe7b0fd0a3d00e8db8f08966a4 by Maik Qualmann.
Committed on 07/04/2024 at 06:55.
Pushed by mqualmann into branch 'master'.

add test debug for color filter change

M  +1    -1    core/libs/database/models/itemfiltersettings.cpp
M  +2    -1    core/libs/filters/colorlabelfilter.cpp

https://invent.kde.org/graphics/digikam/-/commit/0cb8f4a999dc48fe7b0fd0a3d00e8db8f08966a4
Comment 5 Maik Qualmann 2024-04-07 07:02:59 UTC
You may be able to compile from git/master yourself, otherwise we'll wait for the next AppImage to get the test debug messages.

Maik
Comment 6 Maik Qualmann 2024-04-07 07:45:37 UTC
Git commit 0ca82655bbb6ed0057ff92c50a91d5f1578f80c3 by Maik Qualmann.
Committed on 07/04/2024 at 07:44.
Pushed by mqualmann into branch 'master'.

show only matches in the debug output

M  +2    -2    core/libs/database/models/itemfiltersettings.cpp

https://invent.kde.org/graphics/digikam/-/commit/0ca82655bbb6ed0057ff92c50a91d5f1578f80c3
Comment 7 Maik Qualmann 2024-04-07 09:31:26 UTC
A new AppImage with the test debug for the color filter is available.
Please post the debug output of this AppImage from setting the color filter.

https://files.kde.org/digikam/

Maik
Comment 8 Maik Qualmann 2024-04-07 11:16:57 UTC
Git commit 790ed4b646edba32bbfabddcb82bd52016819550 by Maik Qualmann.
Committed on 07/04/2024 at 11:16.
Pushed by mqualmann into branch 'master'.

fixes a possible settings problem with the color/pick label filter
In combination with the option images without tags and the tag
condition "AND", the color/pick label did not work.

M  +17   -17   core/app/filters/filtersidebarwidget.cpp

https://invent.kde.org/graphics/digikam/-/commit/790ed4b646edba32bbfabddcb82bd52016819550
Comment 9 Christoph Scheurer 2024-04-07 12:33:11 UTC
Created attachment 168249 [details]
Debug log with digiKam-8.4.0-20240407T113137-x86-64-debug.appimage

Thanks for the quick turnaround and sorry for the delay on my side.

I downloaded digiKam-8.4.0-20240407T113137-x86-64-debug.appimage and conducted the test like before.
The result is unchanged.
Comment 10 Christoph Scheurer 2024-04-07 12:42:33 UTC
(In reply to Maik Qualmann from comment #8)
> Git commit 790ed4b646edba32bbfabddcb82bd52016819550 by Maik Qualmann.
> 
> M  +17   -17   core/app/filters/filtersidebarwidget.cpp
I have downloaded the patched file and will build my local version also with that patch applied.
Comment 11 Christoph Scheurer 2024-04-07 12:56:50 UTC
(In reply to Christoph Scheurer from comment #10)
> (In reply to Maik Qualmann from comment #8)
> > Git commit 790ed4b646edba32bbfabddcb82bd52016819550 by Maik Qualmann.
> > 
> > M  +17   -17   core/app/filters/filtersidebarwidget.cpp
> I have downloaded the patched file and will build my local version also with
> that patch applied.

Same result also in the locally compiled version: color filter is still not working.
Comment 12 Maik Qualmann 2024-04-07 14:02:53 UTC
Git commit 50bc1bd666d4f72b3148f2adfd639488b15036b0 by Maik Qualmann.
Committed on 07/04/2024 at 14:02.
Pushed by mqualmann into branch 'master'.

add more debug for the color label filter

M  +2    -2    core/libs/database/models/itemfiltersettings.cpp
M  +2    -2    core/libs/filters/colorlabelfilter.cpp

https://invent.kde.org/graphics/digikam/-/commit/50bc1bd666d4f72b3148f2adfd639488b15036b0
Comment 13 Maik Qualmann 2024-04-07 14:24:16 UTC
Ok, I missed this message in the log:

AlbumManager::scanTAlbums[0m: Failed to find parent tag for tag  "_Digikam_Internal_Tags_"  with pid  -1

We can't really fix this with digiKam, it's best to start with a new database. Alternatively, you can send me your database as a ZIP file and I will repair it.

Maik
Comment 14 Christoph Scheurer 2024-04-07 15:49:18 UTC
> AlbumManager::scanTAlbums[0m: Failed to find parent tag for tag 
> "_Digikam_Internal_Tags_"  with pid  -1
Ok - I had noticed that in the first log but do not know what it means ...

> We can't really fix this with digiKam, it's best to start with a new
> database. Alternatively, you can send me your database as a ZIP file and I
> will repair it.
Thanks for the offer! I assume that requires some munging on the SQL tables?
I would not be afraid of doing that myself. Any pointers what this would involve?
Comment 15 Maik Qualmann 2024-04-07 16:14:13 UTC
Created attachment 168260 [details]
tagstable.png

Install the sqlitebrowser, open the digikam4.db.
Look at the screenshot, this is what it should look like, the "_Digikam_Internal_Tags_" is actually usually the first entry in the DB with the id == 1 and the pid == 0. In your case the pid should be != 0, probably -1. Change the pid again or take a screenshot. Also check whether the "_Digikam_Internal_Tags_" is not present twice.

Maik
Comment 16 Christoph Scheurer 2024-04-07 16:27:32 UTC
Thanks! I'll give it a try.
Comment 17 Christoph Scheurer 2024-04-07 20:52:10 UTC
> Install the sqlitebrowser, open the digikam4.db.
Correcting the pid of "_Digikam_Internal_Tags_" indeed solved the problem. It was at -1 before.

Thanks a lot!
Comment 18 Christoph Scheurer 2024-04-08 06:51:07 UTC
Summary: the failure of the color/pick filters was due to an inconsistency in the "Tags" table of the SQL database.