After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 722756 - Include matching folder names when doing text searches
Include matching folder names when doing text searches
Status: RESOLVED OBSOLETE
Product: shotwell
Classification: Other
Component: search
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: Shotwell Maintainers
Shotwell Maintainers
review
: 718943 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-01-22 06:47 UTC by ritchiew
Modified: 2021-05-19 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
adds keywords from folder path to valid search terms (1.59 KB, patch)
2014-01-22 06:47 UTC, ritchiew
none Details | Review

Description ritchiew 2014-01-22 06:47:51 UTC
Created attachment 266948 [details] [review]
adds keywords from folder path to valid search terms

I have my photos organized in directories with names meaningful to me. Now in Shotwell, when I click "Find" and enter some text, I want the results to include pictures in directories which match that text.

If the photo is in the library directory, the match should work anywhere along the path from the library root. So if a photo is at /path/to/library/root/Vacations/Summer/Boston/ocean.jpg, the text search should include this image on inputs like "vacation", "summer", or "boston".

If the photo is not in the library directory, the match should only work on the image's parent directory.
Comment 1 Jim Nelson 2014-01-23 01:21:45 UTC
Thanks!  We'll review shortly.
Comment 2 Jim Nelson 2014-02-05 01:39:21 UTC
Pushed to master, commit 51f04e
Comment 3 Jim Nelson 2014-02-11 22:26:17 UTC
ritchiew, I've had to revert this commit.  See bug #723835 for additional details.

I attempted to fix the bug when Sebastien first reported it.  My theory was that the keyword generation code was too far down the inheritance stack.  MediaSource is a generic object and, I thought, also the subclass for the camera objects when you go to import photos.  I wondered if the problem was due to your code traversing the *camera's* directory structure, which is obviously bound to be very slow.  So, I moved it up the stack to LibraryPhoto, which means only photos imported into the library would generate folder keywords, which seemed appropriate to me.  However, as Sebastien reported, my changes didn't fix the problem.

In my haste to try and fix the problem I overlooked that MediaSource is not a subclass of ImportSource, so in fact I believe your commit was properly placed in the class hierarchy.  However, the hang problem remains.

While looking at Sebastien's bug, I realized there were some other problems with the original commit.  Since the photo's filepath can change (if the user moves or renames it), LibraryPhoto needs to detect that situation and re-generate keywords.  I coded up that work as well.  That code needs to be moved to MediaSource for this to land.

My changes are on the wip/723835-camera-hang branch.

If you'd like to get this in, I need for you to (a) attempt to repro Sebastien's issue in bug #723835 and (b) produce a patch that fixes those problems as well as incorporates the work I did in the wip branch into your changes in MediaSource.

I know this is a bit confusing, but the problem is confusing as well.  I don't understand how your changes could have introduced this problem, but Sebastien was able to git bisect back to your patch.

Thanks!
Comment 4 Jean-Eric Duret 2014-02-13 01:41:37 UTC
Hello,

If this could help you.

Only when there is one or more photo at the root library (for example : /path/to/library/root/ocean.jpg), I have the following three messages indefinitely :

(shotwell:13228): GLib-GIO-CRITICAL **: g_file_get_basename: assertion 'G_IS_FILE (file)' failed
(shotwell:13228): GLib-GIO-CRITICAL **: g_file_get_parent: assertion 'G_IS_FILE (file)' failed
(shotwell:13228): GLib-GIO-CRITICAL **: g_file_equal: assertion 'G_IS_FILE (file1)' failed

And there is the backtrace :
(gdb) bt
  • #0 write
    from /lib64/libpthread.so.0
  • #1 ??
    from /usr/lib64/libglib-2.0.so.0
  • #2 g_log_default_handler
    from /usr/lib64/libglib-2.0.so.0
  • #3 g_logv
    from /usr/lib64/libglib-2.0.so.0
  • #4 g_log
    from /usr/lib64/libglib-2.0.so.0
  • #5 g_file_get_parent
    from /usr/lib64/libgio-2.0.so.0
  • #6 media_source_get_keywords_from_path
    at ./shotwell/src/MediaDataRepresentation.vala line 161
  • #7 media_source_update_indexable_keywords
    at ./shotwell/src/MediaDataRepresentation.vala line 87
  • #8 media_source_real_notify_membership_changed
    at ./shotwell/src/MediaDataRepresentation.vala line 76
  • #9 data_collection_real_add_many
    at ./shotwell/src/core/DataCollection.vala line 355
  • #10 library_photo_init
    at ./shotwell/src/Photo.vala line 4910
  • #11 library_exec
    at ./shotwell/src/main.vala line 124
  • #12 _vala_main
    at ./shotwell/src/main.vala line 420
  • #13 main
    at ./shotwell/src/main.vala line 317

Comment 5 Jim Nelson 2014-02-13 02:45:54 UTC
beguam, this appears to be a separate bug.  Thanks for pointing it out, that too needs to be addressed.
Comment 6 ritchiew 2014-02-19 04:19:07 UTC
Thanks, all. I pushed some changes to a branch on github:
https://github.com/ritchiewilson/shotwell/tree/keywords

What is there fixes beguam's bug. I'm still having trouble understanding or reproducing bug #723835, however this change should sidestep it. Instead of traversing the file system, this now just gets the filepath from the database. So the file system isn't touched.

Last is regenerating keywords when files are moved or renamed. Jim, I believe what I have already works. The method update_indexable_keywords() already gets called when files move (in case the basename changes) and any search gets updated automatically. Can you give me an example for when this fails?
Comment 7 Jim Nelson 2014-02-19 20:39:29 UTC
ritchiew, thanks for sticking with this.

To be honest, I don't believe your original patch had any significant blocking I/O.  If you look at File.get_basename and File.get_parent, they are specifically documented as not performing I/O.  They are parsing methods, nothing more.  The only call that is slightly worrisome is AppDirs.get_import_dir which calls into GSettings, however, GSettings is supposed to do caching and not hit the disk each time.  (I admit, that's not a rock-solid assurance.)  Still, what no one has really explained is how any of this, including GSettings, would trigger a problem deep inside GVFS.

It looks to me that this patch merely replaces the calls to get_parent and get_basename with array-slicing calls.  I'd need to verify that these really do solve the camera problem.  Also, you're correct, update_indexable_keywords() will get called when the backing file is changed; I missed the call in notify_altered().

In any event, we've passed feature freeze for Shotwell.  This is fairly small, and if the branch doesn't repro the reported camera problem, I'll consider it for 0.18.
Comment 8 Jim Nelson 2014-05-12 21:11:26 UTC
*** Bug 718943 has been marked as a duplicate of this bug. ***
Comment 9 nemoinis 2016-04-04 23:42:21 UTC
> I'll consider it for 0.18.

It's now 0.22. Was this feature forgotten? It's so essential for anyone migrating from Picasa or using a job/project-based folder organization. Which describes just about all my photographer clients...
Comment 10 Jens Georg 2016-06-29 07:42:36 UTC
Considering for 0.26, and depending on how I get through with the 0.24 bugs one of the candidates to handle in 0.24 if there's time
Comment 11 GNOME Infrastructure Team 2021-05-19 14:00:22 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/shotwell/-/issues/4451.