Bug 308342 - Search by age reports wrong results
Summary: Search by age reports wrong results
Status: CONFIRMED
Alias: None
Product: kmail2
Classification: Applications
Component: search (show other bugs)
Version: 5.4.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-13 20:28 UTC by Luis Silva
Modified: 2017-01-13 14:38 UTC (History)
5 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luis Silva 2012-10-13 20:28:39 UTC
The search by age in kmail does not and cannot work in it's current implementation.
In kdepim/mailcommon/searchpattern.cpp, the comparison is presently made with a QDate instead of a QDateTime. This makes the search not work at all.
Moreover, the age value is not subtracted from the present date but added. I have a patch correcting these issues but then the comparison is inverted, an issue I do not know how to correct. For example, searching for mail with an age "lower or equal" than "3 days" produces the following query (today is 2012-10-13):
select distinct ?r ?reqProp1 where { { ?r <http://akonadi-project.org/ontologies/aneo#akonadiItemId> ?reqProp1 . ?r <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#sentDate> ?v1 . FILTER(?v1<="2012-10-10T23:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>) . ?r a <http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#Email> . FILTER EXISTS { ?r a [ <http://www.semanticdesktop.org/ontologies/2007/08/15/nao#userVisible> "true"^^<http://www.w3.org/2001/XMLSchema#boolean> ] . } . } . }

Reproducible: Always
Comment 1 Martin Koller 2013-02-04 14:20:12 UTC
I can confirm that the filter for "Age in Days" does not work with KDE-4.10 RC3
Comment 2 Laurent Montel 2013-08-31 09:12:30 UTC
it's right it doesn't work.
Comment 3 Laurent Montel 2013-10-07 07:28:03 UTC
I disabled date search in 4.12 because nepomuk doesn't have date support
it has datetime support but not date only support.
Wait that nepomuk will improve
Comment 4 luisfe 2014-09-15 17:17:11 UTC
In 4.14 one can still search by "age in days" but the result is plainly wrong.
Comment 5 Martin Steigerwald 2015-09-09 20:18:34 UTC
Hello Luis. Thank you for your report.

Laurent, is it possible to have search by age with with Baloo/Akonadi Search?

Thanks,
Martin
Comment 6 Denis Kurz 2017-01-13 14:38:28 UTC
What luisfe said in Comment 4, but for 5.4.1.

If the search backend (baloo, as it is now) does not support searching by age, the option should be removed from the search dialog.

I searched for messages younger than 3 days, and the search came up with every email I ever received, including very old ones and those from today or yesterday.