[KPhotoAlbum] Idea for quick search feature

Jan Kundrát jkt at gentoo.org
Wed Apr 25 22:05:37 BST 2007

Shawn Willden wrote:
> It would require a search bar syntax that allows precise specification (e.g. 
> Persons:"Jesper K Pedersen") as well as "loose" specification (e.g. Jesper, 
> which would search all metadata), but it would address the issue of 
> composition by effectively making the search bar the single search mechanism, 
> with searches being specified by some combination of typing and clicking (or 
> pure clicking or pure typing).
> That's a bit more radical, but it might make a lot of sense.
> Comments?

Heh, that's what I'm trying to do in my web frontend. If KPA is about to
support the same method, we should agree on one way to do stuff and even
the UI should look similar.

In my application, a query consists of one or more expressions separated
by logical operators. Right now, I support AND, OR and parentheses.
Speaking about expressions, they are formed by three tokens, "property",
"operator" and "value".

"Property" can be any currently supported EXIF item [1], "label",
"description", "width", "height", "angle", "date" or any defined
category name. If "property" contains anything besides A-Z, 0-9, a-z,
".", "_" and "-", it must be enclosed in double quotes in which it
allows backslash for escaping quotes and backslash.

For EXIF data and "width" and "height", it supports =, !=, <, >, <= and >=.

For label/description, it performs SQL (NOT) LIKE matching via operators
":" and "!".

For dates, it will allow stuff like "date = 2005-11" (operators =, !=,
<, >, <=, >= ).

And finally for categories, currently it supports "category FOO has/has
not value BAR", but nothing else, which means I can't do a query like
"show me all pics of Adam and Barbara where nobody else is". Operators
are ":" and "!". Any suggestions about how to extend it are welcome
(probably something like 'People=first,second,third').

All property names and category values are case sensitive, so asking for
"Width" is an error, unless you happen to have category "Width".

Same operator can be expressed by multiple strings, currently "==" means
"=", "and" == "&&" == "&", "||" == "|" == "or" and they are all

Example query asking for all images with Jane and Paul Verlaine or with
Jane and Bob taken from a Panasonic camera with ISO speed of 250 or more:

People:Jane & (People:"Paul Verlaine" | People:Bob) &
Exif_Image_Make=Panasonic AND Exif_Photo_ISOSpeedRatings >= 250

Any suggestions/comments are welcome. You can try this querying with
{convert,query}.py from [2].


[1] Currently supported EXIF items are "Exif_Photo_FocalLength",
"Exif_Photo_ExposureTime", "Exif_Photo_ApertureValue",
"Exif_Photo_FNumber", "Exif_Photo_Flash", "Exif_Photo_Contrast",
"Exif_Photo_Sharpness", "Exif_Photo_Saturation",
"Exif_Image_Orientation", "Exif_Photo_MeteringMode",
"Exif_Photo_ISOSpeedRatings", "Exif_Photo_ExposureProgram",
"Exif_Image_Make", "Exif_Image_Model"
[2] http://svn.flaska.net/viewcvs/pphotoalbum/trunk/

cd /local/pub && more beer > /dev/mouth

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <http://mail.kde.org/pipermail/kphotoalbum/attachments/20070425/dd472923/attachment.sig>

More information about the Kphotoalbum mailing list