Bug 327957 - MYSQL : text filter returns all videos regardless of string
Summary: MYSQL : text filter returns all videos regardless of string
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Database-Mysql (show other bugs)
Version: 3.4.0
Platform: Mint (Ubuntu based) Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-22 20:29 UTC by shaav
Modified: 2016-05-22 09:57 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description shaav 2013-11-22 20:29:42 UTC
Entering text in the "Text Filter" behaves as expected with images, but all videos in the album are returned in addition to the appropriate images.

Reproducible: Always

Steps to Reproduce:
1. Select an album that contains both images and video
2. Enter the filename of an image in the album into the "Text Filter" field
Actual Results:  
In addition to images that match the text filter string, all videos in the album are also returned

Expected Results:  
videos will be filtered according to the text filter string as well
Comment 1 caulier.gilles 2013-11-22 22:55:06 UTC
I think there is a confusion here.

In Filter tab from right sidebar, the Text filter options available in drop-down menu permit to search string into :

- Image Name
- Image Title
- Image Comment
etc...

In fact, as digiKam manage video as image, the options with "image" are wrong. This must be changed as :

- Name
- Title
- Comment
etc...

To resume, the behavior to return video files with image files when you filter an album is fine.

Gilles Caulier
Comment 2 caulier.gilles 2013-11-24 13:58:58 UTC
Also, use Mime type filter with "Image Files" option to only apply text filter to image items from album.

Gilles Caulier
Comment 3 caulier.gilles 2013-11-24 13:59:29 UTC
Git commit e85a3c2ecd45be29b2b88e26d8884a4720e45abe by Gilles Caulier.
Committed on 24/11/2013 at 13:55.
Pushed by cgilles into branch 'master'.

to be more generic, use "item" instead "image" on text filter options

M  +39   -39   digikam/filters/textfilter.cpp

http://commits.kde.org/digikam/e85a3c2ecd45be29b2b88e26d8884a4720e45abe
Comment 4 shaav 2013-11-25 06:05:16 UTC
Thanks for the feedback Gilles, and I agree that the terms should be more generic, but that isn't the problem. It did, however, help me isolate the problem a little more though.

I have a folder with photos and videos --- they all uniquely, sequentially numbered with different prefixes.  There is an image with the filename "RIA_P_1741.JPG" and a movie: RIA_P_1753.MOV if the settings are:

Text: RIA_P_1741.JPG
Search Field: Image Name ONLY
MIME: All Files

This behaves as expected

Text RIA_P_1753.MOV
Search Field: Image Name ONLY
MIME All Files

This behaves as expected.

In both cases if you change the fields searched to:
* Image Comment
* Image Album Name
* Image Aspect Ratio
* Image Pixel Size
OR any combination that includes one of these ALL movies in the folder are returned as matches.

Changing the Mime type from "All Files" to "Images" in the first example does, of course, filter out all of the movies, but in the second changing it to "Movie Files" does not limit the results.

In fact, I can put ANY random text string in and it will return every movie in the folder as a match if one of the above search fields is selected.
Comment 5 shaav 2013-11-25 06:07:07 UTC
> * Image Album Name

Er... that should be:

* Album Name
Comment 6 caulier.gilles 2013-11-25 07:43:23 UTC
Dysfunction is not reproducible here with 4.0.0-beta1. Look my screenshots of a test album including some JPG, RAF and, MOV :

1/ album content not filtered :

http://www.flickr.com/photos/digikam/11044998484/in/photostream/

2/ album content filtered by item name, with a valid string query, and image type mime :

http://www.flickr.com/photos/digikam/11044877605/in/photostream/

3/ album content filtered by item name, with a valid string query, and video type mime :

http://www.flickr.com/photos/digikam/11044962496/in/photostream/

4/ album content filtered by item name, with a non valid string query, and all type mime :

http://www.flickr.com/photos/digikam/11044961516/

Gilles Caulier
Comment 7 caulier.gilles 2013-11-25 08:11:57 UTC
So, i suspect that something is wrong in your database file to identify type mime of your video file.

With Sqlite3 command line tool, look in digiKam database file "digikam4.db" the type mime of you MOV video file :

SELECT DISTINCT Images.id, Images.name, Images.album, ImageInformation.rating, Images.category, ImageInformation.format, ImageInformation.creationDate, Images.modificationDate, Images.fileSize, ImageInformation.width, ImageInformation.height FROM Images INNER JOIN ImageInformation ON Images.id=ImageInformation.imageid WHERE Images.status=1 AND Images.name="RIA_P_1753.MOV";

With my DB it return this :

[gilles@localhost GILLES]$ sqlite3 digikam4.db 
SQLite version 3.7.17 2013-05-20 00:56:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> SELECT DISTINCT Images.id, Images.name, Images.album, ImageInformation.rating, Images.category, ImageInformation.format, ImageInformation.creationDate, Images.modificationDate, Images.fileSize, ImageInformation.width, ImageInformation.height FROM Images INNER JOIN ImageInformation ON Images.id=ImageInformation.imageid WHERE Images.status=1 AND Images.name="DSCF1010.MOV";
2286|DSCF1010.MOV|75|-1|2|MOV|2012-12-22T19:44:00|2012-12-22T19:44:00|128137088|1920|1080
sqlite> 

Look like the 6nd column is the type mime, and must be MOV in your case.

If it's not the right type mime, In digiKam select you mov file, go to Image/Reread metadata... entry menu, and try to filter album again.

Gilles Caulier
Comment 8 caulier.gilles 2013-11-29 23:25:20 UTC
Shaav,

Do you see my previous comment ?

Gilles Caulier
Comment 9 shaav 2013-12-01 21:34:49 UTC
It is correctly identified as MOV; oddly width and height are NULL.

If it makes any differents I'm using MySQL for the backend.

Is it possible that there is something weird in a SQL join somewhere that isn't behaving correctly with NULLs? Or one that is behaving differently in MySQL vs SQLite?

I will be happy to run queries if you can send me them.

---------------------
60815	RIA_P_1753.MOV	1463	2	2	MOV	2013-11-01 02:45:39	2013-11-01 02:45:39	69154245	NULL	NULL
Comment 10 caulier.gilles 2013-12-01 22:10:29 UTC
Yes MySQL must be the problem. Here i use SQLite...

I know that MySQL interface has bugs.

Gilles Caulier
Comment 11 shaav 2014-09-03 00:54:02 UTC
Incidentally, I am using 4.1.0 with SQLite now and the issue is unchanged. Still happens exactly as described above. MOV shows correctly as the type.
Comment 12 swatilodha27 2016-05-22 09:51:19 UTC
I tried to generate the above issue which is not reproducible.

Steps to reproduce:
1) Created a fresh new album.
2) Added with images and videos. Setting names such that they've common string.
3) Enter name in the "Text Filter" to search for an image.

Expected Results:
Videos/Images are filtered according to the MIME type filter.

Actual Result:
Videos/Images are filtered correctly according to the MIME type filter.