removing item from index ?

	"How to remove an already indexed item from the beagle index ?"
	The above question is frequently asked in IRC so I thought to outline the 
various (sigh!) ways that can be done. Useful to both client writers and end 
users. I should also add this to the wiki FAQ. Deletion interface isnt very 
user-friendly yet, so I suggest to the weak hearted to take alternative paths 
to keep sensitive data out of beagle's scanner :)

- Using UI (beagle-search): None! (As of now)

- Using command line tool: svn trunk (the one in 0.2.17 takes different 
parameters) has the tool beagle-master-delete-button. Use this as follows:
$ beagle-master-delete-button index-name uri-to-delete
And the magic parameters mean:
* index-name: Name of the index. E.g. IndexingServiceIndex for Firefox 
webhistory, FileSystemIndex for file system backend etc. You can use the 
BEAGLE_HOME/BEAGLE_STORAGE environment variables to override where beagle 
index is located.
* uri-to-delete: even clumsier :( the actual uri of the item you want to 
index. As reported by beagle-query. Again, _exactly_ as returned by 
beagle-query. Might need escaping.

The above method will work for any index, as long as the index-name is 
correct; it even tells you if it actually deleted something. Beagled need not 
be running. Live query probably wont notice the deletion though, you have to 
search again to notice the removal.

- Using API: Send removal data to the IndexingService backend, by creating an 
IndexingServiceRequest message, set the correct "Source", ask it to remove a 
bunch of Uri-s and then send it ... whisk! Here "Source" is the source 
backend of the item (obtained from Hit.Source e.g. "Files" for filesystem 
backend, "IndexingService" for firefox backend etc.). 
in C#,
       IndexingServiceRequest request;
       request = new IndexingServiceRequest ();
       request.Remove (uri); // can be called multiple times
       request.Source = "Files"; //filesystem backend
in C,
        BeagleIndexingServiceRequest *request;
        request = beagle_indexing_service_request_new ();
        beagle_indexing_service_request_remove (request, uri);
        beagle_indexing_service_request_set_source (request, "Files");
        beagle_client_send_request (client, BEAGLE_REQUEST (request), NULL);
        g_object_unref (request);

(Of course) requires running beagled. Also, requires IndexingService backend 
to be enabled in beagled (all the external addition/removal requests are 
routed through IndexingService backend). However, requesting removal via the 
API will not result in an immediate removal - the request gets in a queue 
(with quite high priority) and will be processed when its turn comes. So, the 
removal might take a few seconds. Also, the API does not return if the 
removal was successful. But change notification will work! So the user will 
eventually know when the item is removed.

Thats a brief howto. Check the wiki in future, important changes to the 
api/parameters will be mentioned there.

- dBera

Debajyoti Bera @
beagle / KDE fan
Mandriva / Inspiron-1100 user

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]