Bug 334672 - search refinement broken in git master
Summary: search refinement broken in git master
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: Browser (show other bugs)
Version: GIT master
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-12 18:52 UTC by Andreas Schleth
Modified: 2020-04-29 21:02 UTC (History)
1 user (show)

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


Attachments
screenshot with results from git master and kpa4.1.1 (35.78 KB, image/jpeg)
2014-05-12 18:52 UTC, Andreas Schleth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Schleth 2014-05-12 18:52:16 UTC
Created attachment 86596 [details]
screenshot with results from git master and kpa4.1.1

I have some 20k images.  Some of them tagged with Quality = "Hintergrundbild".  Of theses most, but not all are also tagged with Quality = "bearbeitet".  I search for the remaining 26 images this way:

1. search for Quality = "!bearbeitet"
2. select Quality = "Hintergrundbild" (The dialog shows the correct number 26 images)
3. 
Expected result: "show thumbnails" should display 26 images, timeline should only show 26 images 
Actual result: all images are selected, timeline shows all images, thumbnails show all images

This kind of successive refinement had worked for me since 2005.  See the cutout from 4.1.1 (conserved in a virtual machine, working on the very same DB).

For more detailled assessment, see Shakespeare, Hamlet (1.4), Marcellus to Horatio ...  
;-)
Comment 1 Johannes Zarl-Zierl 2014-05-12 20:35:44 UTC
I don't have time to fix this right now, but I can confirm this with the demo database:

1) Search for Places "!Denmark"
2) Browse Places, Select "Newark" (should be 1 image)
3) Show Thumbnails displays the entire demo database.
Comment 2 Andreas Schleth 2014-12-15 16:42:21 UTC
There seems to something of a fix/workaround:
In one go search for "Newark & ! Denmark" - this gives the correct answer.
The other way round "! Denmark & Newark" does not work.

In the latest revison (git 87a0d37) the search terms seem to stick in the dialogue.  So there is no "new search" after the first one is run (excecpt if you delete the search terms manually).
Comment 3 Johannes Zarl-Zierl 2014-12-15 18:49:30 UTC
I just looked at the generated CategoryMatcher, and the issue is easily explained: Contrary to "normal" convention, the "&" binds stronger than the negation.

I.e. when "! Denmark & Newark" is parsed, KPA interprets this as: "! ( Denmark & Newark )".

Unfortunately I don't have a fix for the code in ImageSearchInfo::compile(), yet.
Comment 4 Johannes Zarl-Zierl 2020-04-29 21:02:07 UTC
Git commit 63315771d26e454da3b698ca5c9f5f3e60b3002a by Johannes Zarl-Zierl.
Committed on 29/04/2020 at 21:01.
Pushed by johanneszarl into branch 'master'.

Fix parsing of negation in ImageSearchInfo

M  +4    -2    ChangeLog
M  +3    -1    DB/ImageSearchInfo.cpp

https://commits.kde.org/kphotoalbum/63315771d26e454da3b698ca5c9f5f3e60b3002a