Bug 210845 - Date interval search returns nothing if you specify the same date as interval
Summary: Date interval search returns nothing if you specify the same date as interval
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Searches-Advanced (show other bugs)
Version: 1.0.0
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-17 00:17 UTC by Marco Menardi
Modified: 2017-08-18 09:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 1.0.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Menardi 2009-10-17 00:17:59 UTC
Version:            (using KDE 4.3.2)
OS:                Linux
Installed from:    Debian testing/unstable Packages

If in advanced search, Picture Properties you fill the date interval with the same date (i.e. I want to see the picture of 01/01/09, so I enter that date in both "and" fields), no picture is selected.
If I want those pictures, I have to enter the interval 01/01/09 and 02/01/09. This is not the expected behaviour (the way of such selection usually works).
Comment 1 Andi Clemens 2009-10-17 00:37:27 UTC
True in current SVN
Comment 2 Andi Clemens 2009-10-17 11:43:42 UTC
If I search for
select * from imageinformation where creationdate >= '2005-10-02T00:00:00' and creationdate <= '2005-10-02T00:00:00';

I get no result, but 

select * from imageinformation where creationdate >= '2005-10-02T00:00:00' and creationdate <= '2005-10-03T00:00:00';

will give me images. The question is how to treat this now?
If I really want images from one day, the querybuilder should detect that the dates in the range are the same and set the end date one step higher.

Any other suggestions?

Marcel?

Andi
Comment 3 Marcel Wiesweg 2009-10-17 12:54:42 UTC
There is code in the query builder to handle the "Equal" case.
The search field should write only one date with the relation "Equal".
Comment 4 Marcel Wiesweg 2009-10-17 13:07:28 UTC
SVN commit 1036520 by mwiesweg:

For the case of same date for begin and end of the interval, do not store an
interval but only a single date with the relation "Equal".

Note: For any stored search, you must open the advanced search window and click
OK once to store the search XML the correct way.

BUG: 210845

 M  +2 -1      NEWS  
 M  +37 -12    utilities/searchwindow/searchfields.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1036520
Comment 5 Marco Menardi 2009-10-17 14:39:46 UTC
In any case, if I want the pictures of 01/01/09 AND 02/01/09, equal will not be used and I will have just the pics of 01/01/09.
The problem is that we want to search for DATE, but a TIMESTAMP (date + time) is stored and managed by database (I suspect, I'm not a digiKam developer).
I don't know what database digiKam uses, and if it supports only DATE type field.
If not, and to solve a generic case, we have to set to 00.00 the starting date time part, and to 23.59 (or 11.59pm) the end date interval.
This is also true if we thing that the Time value could be important to us.
Currently we have:
select * from imageinformation where creationdate >= '2005-10-02T00:00:00' and
creationdate <= '2005-10-02T00:00:00';
that could find only pictures created exactly ad time 00.00.00 of 2005-10-02, that are very unlikely to exist :)
With my suggestion we will have:
select * from imageinformation where creationdate >= '2005-10-02T00:00:00' and
creationdate <= '2005-10-02T23:59:59';
that will sure find the pics created that day.
This solution work also in the interval:
select * from imageinformation where creationdate >= '2005-10-02T00:00:00' and
creationdate <= '2005-10-05T23:59:59';
finding the pictures created 02, 03, 04 and 05 October 2005
I suggest then to reopen the bug and fix this way.