Re: Bookmark Queryable

> Also, I forgot to add:
> 7.) Define a plugin model for queryables to be developed and distributed
> outside of beagle.
It is possible to build a queryable outside of beagle. its just not well 
documented. Assuming you understand the distinction between a QueryDriver 
(one which queries existing data sources) and a Queryable (which finds the 
data to index and takes care of indexing), here is a very stupid Queryable
------- >8 --------- UselessQueryable.cs ---- (watch for word wrap) ------
using System;
using System.IO;
using System.Threading;
using System.Collections;

using Beagle.Daemon;
using Beagle.Util;

namespace Beagle.Daemon.MyQyeryable {

        [QueryableFlavor (Name="MyMy", Domain=QueryDomain.Local, 
        public class MyQueryable : LuceneQueryable {

                public MyQueryable () : base ("MyMyIndex")
                        // Initialization e.g.
                        // Setting path of data

                public override void Start ()
                        base.Start ();

                        ExceptionHandlingThread.Start (new ThreadStart 

                private void StartWorker ()
                        // Setup Inotify
                        // Find data e.g. by crawling files

                        // Add an object to the index
                        Indexable indexable = new Indexable (
                                                    new Uri (String.Format (
                        indexable.MimeType = "text/plain";
                        indexable.HitType = "FooType";
                        indexable.Timestamp = DateTime.Now;

                        // Some random properties
                        indexable.AddProperty (Property.New 
("dc:title", "Dummy first item"));
                        indexable.AddProperty (Property.NewKeyword 
("dc:version", "v1.0"));
                        indexable.AddProperty (Property.NewUnsearched 
("fixme:md5", "U7SD67676F7"));

                        // Add text data
                        StringReader st = new StringReader ("This is not a 
very long string");
                        indexable.SetTextReader (st);

                        // Send indexable to scheduler
                        Scheduler.Task task;
                        task = NewAddTask (indexable);
                        task.Tag = "sometag";
                        ThisScheduler.Add (task);

                public string StatusName {
                        get { return "Working"; }
----------------------------------- >8 -----------------------------
* Compile this as 
$mcs -debug -nowarn:0162,0164,0168,0169,0219,0436 -out:MyBackend.dll -target:library 
UselessQueryable.cs  -r:$PREFIXlib/beagle/BeagleDaemonLib.dll -r:
$PREFIXlib/beagle/Util.dll -r:$PREFIXlib/beagle/Beagle.dll
* Copy MyBackend.dll to $PREFIX/lib/beagle/Backends
* Verify using beagled --list-backends that the backend MyMy is loaded.
* Start using MyMy backend
* WARNING! The backend is extremely dumb (it doesnt do _anything_ useful) and 
unhealthy for beagle (whenever started, it throws all data to the scheduler - 
ideally all indexables should be added to the scheduler queue by 
IIndexableGenerator and all text handling should preferably be done by the 

For more information on Queryables, Querydrivers and Filters, check the Wiki. 
There are docs here and there on those issues.

> 8.) Build a plugin mechanism in the UI and libbeagle
What do you mean by plugin for libbeagle ? What kind of plugins are you 
looking for ?

- dBera

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

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