Bug 512267 - Advanced Search Tool work in a non-logical way on request about missing field
Summary: Advanced Search Tool work in a non-logical way on request about missing field
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Searches-Advanced (other bugs)
Version First Reported In: 9.0.0
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: omimet@free.fr
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-11-17 22:10 UTC by omimet@free.fr
Modified: 2025-12-25 10:59 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In: 9.0.0
Sentry Crash Report:


Attachments
Results of some of my tests on Advanced search (104.08 KB, application/pdf)
2025-11-18 11:04 UTC, omimet@free.fr
Details
Video showing a bug in Advanced Search (2.57 MB, video/mp4)
2025-11-19 00:19 UTC, omimet@free.fr
Details
metadata of video .mov (268.37 KB, image/webp)
2025-11-20 15:20 UTC, omimet@free.fr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description omimet@free.fr 2025-11-17 22:10:20 UTC
SUMMARY
Requests made about the status empty or missing of the "Make" field (The manufacturer of the camera) give some so strange (non logical and false) results, preventing to list correctly elements with empty or missing searched field.
NB : when existing, the "empty" category is populated in the drop-down list of the relevant filter (in the form of a blank item), while the "missing" one is ignored, requiring to proceed by multiple NAND operation (which could ask for manual correction each time a new category is added) ....
This feature should be very usefull to isolate such kind of elements to manually update them.


STEPS TO REPRODUCE
1. import in a new database the attached sample collection, with 3 elements based on variations of the "Make" EXIF field (The manufacturer of the camera) :
      - one with "Make"="Nikon" (issued from a DSLR)
      - one without "Make" field (issued from smartphone by saving a picture embedded in a SMS/MMS)
      - one with existing "Make" field, but empty (issued manually through Exiftool, for test)

2.  Open the Advanced Search Tool (left sidebar)

3. Ensure there is no remaining criteria and options is on "Meet all the following conditions" (push reset button)

4.  Make the 10 requests figured in the attached dashboard (operand, options and criteria)

5. compare results versus your expectations (hope mine are correct!)


OBSERVED RESULT
My results in the attached dashboard


EXPECTED RESULT
My expectations in the attached dashboard (gaps in red)
Notice that all these gaps are linked with the use of a status empty or missing of the "Make" field in the request.
Observe that using empty (#blank) value in the request can lead the request toward gaps on NIKON elements....


SOFTWARE/OS VERSIONS
Linux/Fedora 43 (gnome/wayland) with daily update
DIGIKAM 8.9.0 (appimage, with daily update)
 

ADDITIONAL INFORMATION
This issue can be linked with bug 467715 (but geographic fields), 479133 (but for date fields) or 496514 (where IanMac said "I need a facility which searches for things not being there"
Comment 1 Maik Qualmann 2025-11-18 09:01:31 UTC
Please note that in the advanced search, we do not directly search the metadata fields of the items. We search in the database. We currently do not distinguish between empty and non-existent entries. It would be possible to check the database for a "NULL" entry.

Maik
Comment 2 omimet@free.fr 2025-11-18 10:17:17 UTC
Okay...! I realise ... now...  the consequences of this remark, already seen from you in different posts.... 
Is there a way to see/check what is embedded exactly in the database for each element (toogle in the metadata view for example)?
Comment 3 omimet@free.fr 2025-11-18 11:04:10 UTC
Created attachment 186917 [details]
Results of some of my tests on Advanced search
Comment 4 Maik Qualmann 2025-11-18 11:57:32 UTC
As I said, you can't currently search for an empty camera make. The search is also a "LIKE" database SQL query.

If I understand you correctly, you want all images that have either an empty or a NULL entry in the camera make field, right?

Maik
Comment 5 omimet@free.fr 2025-11-18 13:59:06 UTC
Correct ! 
But by "It would be possible to check the database for a "NULL" entry" are you speaking about a kind of SQL request I could make? (if "missing" status is not managed today at database level, I suppose a query can't rebuild this information...otherwise digikam could make it)
Comment 6 Maik Qualmann 2025-11-18 19:45:45 UTC
Git commit af26b03e5dcd0d3304a18c7e85fe279eb1d2d068 by Maik Qualmann.
Committed on 18/11/2025 at 19:44.
Pushed by mqualmann into branch 'master'.

add search for items without camera make, model and lens
FIXED-IN: 8.9.0

M  +1    -1    NEWS
M  +18   -0    core/libs/database/item/query/itemquerybuilder.cpp
M  +27   -0    core/utilities/searchwindow/searchfields_createfield.cpp
M  +3    -0    core/utilities/searchwindow/searchgroup.cpp

https://invent.kde.org/graphics/digikam/-/commit/af26b03e5dcd0d3304a18c7e85fe279eb1d2d068
Comment 7 omimet@free.fr 2025-11-19 00:19:03 UTC
Created attachment 186937 [details]
Video showing a bug in Advanced Search

This video shows an Advanced Search designed to list only elements with Make field empty.... but including a Make=NIKON in the result !!!
I reopen this bug report because I'm not sure to see this issue solved by the "add search" launched upstream.
NB : this issue occured 3 times with 3 differents setup during my tests (see items 3, 6, 8, in the first attachment to this bug report)
Comment 8 Maik Qualmann 2025-11-19 07:29:54 UTC
Git commit ff1be0d02ba9e7673a2763b5f64ae691a595cde6 by Maik Qualmann.
Committed on 19/11/2025 at 07:29.
Pushed by mqualmann into branch 'master'.

use a choice field for no camera info

M  +41   -16   core/libs/database/item/query/itemquerybuilder.cpp
M  +10   -20   core/utilities/searchwindow/searchfields_createfield.cpp
M  +1    -3    core/utilities/searchwindow/searchgroup.cpp

https://invent.kde.org/graphics/digikam/-/commit/ff1be0d02ba9e7673a2763b5f64ae691a595cde6
Comment 9 Maik Qualmann 2025-11-19 08:37:21 UTC
A new version of digiKam will soon be available, in which you can search for empty camera info fields.

The behavior with an empty field in your video is normal; it's a "LIKE" search. A query with LIKE '%%' will also return results for values. I will remove "empty" camera info fields from the list.

Maik
Comment 10 omimet@free.fr 2025-11-19 10:09:11 UTC
Hi Maik,
In my idea, the LIKE '%%' operand return strings with exactly 2 any characters, what I can't see in the Make field of the 2 pictures in my video ("" and "NIKON CORPORATION"). So I suppose your answer is not so simple, and I don't want make you loosing your time in more detailed explanations (not sure to be able to follow you!) .
I'd rather the common user point of view in my video:
- I search for all elements with the Make field empty
- so, I build a request for 'The manufacturer of the camera' equal string ""
- and I get inside elements with the Make field not empty !

=> it's not logical at all for me, while you tell me it's normal !
I can't leave without clarification : Where is the root cause : my wrong logical view, the building of my request? ...anything else?
Thanks in advance.
Olivier
Comment 11 Maik Qualmann 2025-11-19 11:33:14 UTC
Git commit 7b8d1911da2d414a09eb9613d1448ebe4f2bfa8f by Maik Qualmann.
Committed on 19/11/2025 at 11:32.
Pushed by mqualmann into branch 'master'.

ignore empty make and model in the list

M  +10   -2    core/utilities/searchwindow/searchfields_createfield.cpp

https://invent.kde.org/graphics/digikam/-/commit/7b8d1911da2d414a09eb9613d1448ebe4f2bfa8f
Comment 12 Maik Qualmann 2025-11-19 13:54:18 UTC
Please test the new AppImage with a new search option to search for empty Make, Model or Lens.

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

Maik
Comment 13 omimet@free.fr 2025-11-20 15:20:17 UTC
Created attachment 186991 [details]
metadata of video .mov

Thank you Maik, it works.
Just to be highlighted : Quicktime videos (.mov) are not rejected by this filter (as you can see in attachment, they have a similar Make field, but in a section "Quicktime" vs "EXIF"). But no so big qty in my case, manually manageable...
And finally.... : do we have to consider that the empty/missing status of fields will be managed by Advanced Search in a coming future or not? is it in the digikam roadmap?
Thanks again.
Best regards
Olivier
Comment 14 Maik Qualmann 2025-11-21 12:35:01 UTC
Regarding the video files, I also noticed that they don't contain camera information in the database. Therefore, I've added the scanning of image-relevant metadata to video files as well.

So please re-read the metadata of the video files. If they contain a make or model, this information should now also be saved in the database.

Maik
Comment 15 omimet@free.fr 2025-11-22 12:10:02 UTC
Done.
empty/missing  filtering is working well for Make/Model/Lens.
I'm now able to identify elements with bad creation date (pictures & video).
Thank you very much.
NB : from my experience, 2 sources for this kind of elements :
- video/pictures received by MMS/SMS (except through iMessage...), 
- video from my game/track camera (wich is tagging well Make/Model field for images, but not for videos!)