Bug 424165

Summary: Negated terms in queries
Product: [Frameworks and Libraries] frameworks-baloo Reporter: vini.ipsmaker
Component: generalAssignee: Stefan Brüns <stefan.bruens>
Status: CONFIRMED ---    
Severity: normal CC: j.straight-kde, nate, tagwerk19
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description vini.ipsmaker 2020-07-13 17:40:26 UTC
Nepomuk's Query class allowed construction from a manually created Term object. This setup allowed one to use the negation basic logic operator. Baloo's Query dropped the possibility to feed a manually created Term object and moved Term to implementation details. However, in doing so, it also dropped support for such operator (only AND and OR are supported). Negation is a basic logic operator and should be supported.

My use case is very simple. Every time I read a document, I tag it with "already-read". I want to search for every document in the tag "project1" that isn't tagged as "already-read".

Baloo's Term class still retains the "negated" property. I believe one only needs to update the function Term::fromVariantMap() and it'll automatically propagate to a few upper classes and functions such as Query::fromJSON().
Comment 1 Nate Graham 2020-07-13 18:14:46 UTC
Sounds like you're pretty close to writing a patch for this. :) Wanna go all the way and submit one?

https://invent.kde.org/frameworks/baloo/-/merge_requests
Comment 2 Stefan Brüns 2020-07-13 19:02:47 UTC
Its not only the query which has to be updated, it also has to be executed. Thats the non-trivial part.
Comment 3 vini.ipsmaker 2020-08-14 21:55:01 UTC
> Sounds like you're pretty close to writing a patch for this. :) Wanna go all the way and submit one?

I thought more about the problem and -- as Stefan Brüns pointed out -- the query processor will have to be upgraded too. Old Nepomuk would rely on OpenLink Virtuoso for query execution, so no code from old code base could be used as a reference in the new Baloo framework.

I'll just find a workaround for my use-case.
Comment 4 Stefan Brüns 2023-11-13 08:48:51 UTC
*** Bug 474994 has been marked as a duplicate of this bug. ***