GNOME Bugzilla – Bug 307812
beagle should index nautilus metadata
Last modified: 2007-03-06 21:08:16 UTC
We need to index nautilus emblems and notes.
OK, I have got a first pass of this working, still needs some tuning.
Doesn't seem to be in (it does not work for me and this bug does still exist) so maybe this patch i found on the dashboard mailing list does what we want? http://mail.gnome.org/archives/dashboard-hackers/2004-June/msg00032.html
I managed to dig up the old patch which I was working on. But it is still far from finished, I'm putting it here in case anyone else wants to continue work on it. I dont have the time or will to work on it more at the moment. Sorry. :-) Known problems: * We have to use the sqlite store for the metadata files (see bgo #315228) * NautilusTools suck - I used XmlSerialization which sucks and is much of an overhead. This should be reimplemented. Actually the whole file is a mess, a rewrite would really help it! * There is no way of knowing when the metadata for a file was deleted. * Code needs to be written which would update the already indexed files when the metadata for them is added. There are FIXMEs in NautilusMetadataCrawler.cs for this. * I haven't touched this code for ages so it might now work anymore and I'm not sure I have written all the issues that I faced before. It is very hard to write this in a way that will work perfectly.
Created attachment 63633 [details] [review] not so working patch
is this bug outdated in CVS? or is this still unimplemented, in which case, I would be willing to look at some of the NautilusTools code and update/get that working.
I think this doesn't work at all in CVS. The patch I posted above is most likely the best way to go but it hasn't been touched in ages and is a total mess. And also it needs fixing the issues I pointed above.
Created attachment 64178 [details] [review] It indexes it.... This probably does about 400 things wrong, but it works at the core, and adding the UI elementto display an emblem or add a note should be pretty easy for anyone with gtk experiance.
*** Bug 340768 has been marked as a duplicate of this bug. ***
Created attachment 65193 [details] [review] Index Nautilus Notes, with preliminary inotify Ok, this not only indexes all nautilus notes (into beagle:notes property) but has some basic inotify support going on to detect changes to notes and react instantaneously. I need a lot of help testing this, since I don't really use notes regularly.
Created attachment 66258 [details] [review] Update, and adds Emblem Support, along with UI integration. Another update to my patch, fixes an issue with inotify events being called before the queryable has finished initializing. Also adds initial indexing of emblems, and the UI elements to super impose emblems much the same way we do with f-spot. To test this, you need to have the emblem image file in the beagle images folder.
Created attachment 67223 [details] [review] Updated Patch for Nautilus Metadata Indexing Ok, this is a pretty major patch compared to the others up here. This is not only significantly more stable, but just makes more sense. All metadata is indexed in the FSQ and I have added emblem support based upon the current theme, in short, this is cool, and you should consider giving it a try and me some feedback :)
Created attachment 67631 [details] Add basic support for directories metadata
Created attachment 67639 [details] [review] Update Inotify stuff Ok, I had to scrap some of the instantaneous Inotify stuff in favor of just queuing the directory for a recrawl. In short, it wasn't working and there wasn't and efficient way to respond to an inotify event.
Created attachment 67819 [details] [review] First cut at this Here's my first pass at it. All the nautilus code is separated out into its own file, and the FSQ code only calls into it thrice. Properties are not updated correctly when the metafiles change, because the URIs need to be remapped from the external file URIs to the internal uid URIs. Figuring out how to cleanly do that is the next step. I just wanted to checkpoint in case I don't come back to this before GUADEC.
Created attachment 67871 [details] [review] Updated patch Rewriting of the existing properties now works correctly. Started doing the UI part based on Kevin's work, but the pixbuf.Composite() function is crashing for me for some reason which I'll need to check into later.
Hi > ... Started doing the UI > part based on Kevin's work, but the pixbuf.Composite() function is crashing for > me for some reason which I'll need to check into later. Ran into a similar problem trying to compose images for RSS Feeds - If you find out why it crashes please let me know. Max
Ok, one bug I have been noticing with the nautilus stuff is as follows Debug: -http://digg.com/users/kkubasik/friends/list Debug: +http://digg.com/users/kkubasik/friends/list Warn: Caught exception in DoTaskReal Warn: Tag: Tree Crawler Warn: Creator: Warn: Description: Pending directories: 1 Warn: Priority: Delayed (0) Warn: System.NullReferenceException: Object reference not set to an instance of an object in [0x00020] (at /home/kjk38/mysrc/beagle-svn/Util/NautilusTools.cs:87) Beagle.Util.NautilusTools:GetMetaFileNode (System.String path) in [0x00001] (at /home/kjk38/mysrc/beagle-svn/Util/NautilusTools.cs:119) Beagle.Util.NautilusTools:GetEmblem (System.String path) in [0x00001] (at /home/kjk38/mysrc/beagle-svn/beagled/FileSystemQueryable/NautilusMetadata.cs:113) Beagle.Daemon.FileSystemQueryable.NautilusMetadata:AddPropertiesToIndexable (Beagle.Indexable indexable, System.String path) in [0x0005d] (at /home/kjk38/mysrc/beagle-svn/beagled/FileSystemQueryable/FileSystemQueryable.cs:235) Beagle.Daemon.FileSystemQueryable.FileSystemQueryable:DirectoryToIndexable (System.String path, Guid id, Beagle.Daemon.FileSystemQueryable.DirectoryModel parent) in [0x0004d] (at /home/kjk38/mysrc/beagle-svn/beagled/FileSystemQueryable/FileSystemQueryable.cs:567) Beagle.Daemon.FileSystemQueryable.FileSystemQueryable:ScheduleDirectory (System.String name, Beagle.Daemon.FileSystemQueryable.DirectoryModel parent, Beagle.Daemon.FileAttributes attr, Boolean is_walkable) in [0x00117] (at /home/kjk38/mysrc/beagle-svn/beagled/FileSystemQueryable/FileSystemQueryable.cs:499) Beagle.Daemon.FileSystemQueryable.FileSystemQueryable:AddDirectory (Beagle.Daemon.FileSystemQueryable.DirectoryModel parent, System.String name) in (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_DirectoryModel_string (Beagle.Daemon.FileSystemQueryable.DirectoryModel,string) in [0x000e3] (at /home/kjk38/mysrc/beagle-svn/beagled/FileSystemQueryable/TreeCrawlTask.cs:100) Beagle.Daemon.FileSystemQueryable.TreeCrawlTask:DoTaskReal () in [0x00054] (at /home/kjk38/mysrc/beagle-svn/Util/Scheduler.cs:267) Beagle.Util.Scheduler+Task:DoTask () Debug: -http://digg.com/users/kkubasik/friends/list Debug: +http://digg.com/users/kkubasik/friends/list It only seems to occur when there is a hidden file, I'm gonna look at the code now, but getting it here in case I forget.
Ok, I think something like this should fix the error above. Index: Util/NautilusTools.cs =================================================================== --- Util/NautilusTools.cs (revision 72) +++ Util/NautilusTools.cs (working copy) @@ -82,6 +82,8 @@ XmlDocument doc = GetMetaFileDoc (path); string name = Path.GetFileName (path); + if (name == null) + return null; string xpath = String.Format ("/directory/file[@name=\"{0}\"]", StringFu.HexEscape (name)); return doc.SelectSingleNode (xpath); } And I noticed something else, Joe chose to make the emblems stored as unsearched, it seems to me that they might actually be more of keywords, because of their significance. Unfortunately, the defaults take very sweeping names, so I dunno, but it would seem if I made an emblem say 'beagle' then a search for beagle would ideally return all my files tagged as beagle. Just a thought, this seems like something good to get rolling soon, since max will probably want to integrate it with a lot of his stuff.
Created attachment 70814 [details] [review] Minor adjustments/sanity checks Just some sanity checks and the like.
Any thoughs on if/when we should aim to get this in CVS? And a recap of major todo's would be greatly appreciated on my part.
I had kind of been holding off on this until Max's metadata work went in, but it's probably ok to do beforehand. I don't understand why the Path.GetFileName() method is returning null and causing the error you're seeing. The null check might be working around another bug. As for emblems, the right thing to do is probably to make them searched, but stored individually, instead of all as one property.
Created attachment 78291 [details] [review] Another Update, more solid, still needs UI work though. Ok, more updating work on this, more or less functional, the whole emblems on the search result thing still doesn't work quite right, but were indexing and handling events well, so thats a start! Let me know what you think.
I found out what the cause of the crashing was: the image we were trying to composite to was read-only because it was mmap()ed in. See this commit for more info: http://cvs.gnome.org/bonsai/cvsquery.cgi?branch=&dir=beagle&who=joeshaw&date=explicit&mindate=2006-12-04%2014:58&maxdate=2006-12-04%2015:00 As for the code itself, it seems fine, although nautilus metadata is a prime candidate for a backend after landing the unified indexes branch. Unfortunately, I don't know when that will be.
I just checked in support for indexing additional metadata from different backends, and implemented Nautilus metadata this way. See http://svn.gnome.org/viewcvs/beagle?view=rev&revision=3536 for more info. The last patch is obsolete, but there are still a couple of things in there that are worth using. I'll extract what I can from there and check it in.
Checked the rest of it in as r3537.