Multi-informatica
 

 

 

Products

 

Resources

 

 

 

GooGDB

And delphi project example of GDB indexer plugging for google desktop search: Indexes the metadata in a GDB file ( Firebird or IntraWeb files). Download.

The project is a complete example of "How to do a GDS pluggin in delphi?". Is my first google pluggin of a set of project and components oriented to use and enhanced google in your Delphi programs.

Sorry to those than write me an e-mail requesting the source code and no response...

You have the source here : goo.zip

In this first version, it indexes the metadata of the database. It work only for user (password) knowed files: that is, only for sysdba (masterkey). It try to extract all the possible information, but seem than GDS ignore the leftover info when is greater than a maxleng.

In next versions, I want to include multiple user/password support. Selectable 'kind of information to index', so, you will can to select between index a section of the metadata or data in tables.

More plugging in GDS site. Another GDS delphi example in http://abcavi.kibi.ru/developer.htm.

See the google SDK developer guide for more info about GDS pluggin

 

How To make a GDS plugging.

1. New Project. ActiveX. Activex library. Save Project with name gooini.

2 . Create a COM object. GpIniGDS. It creates an interface IGpIniGDS and a co-class GpIniGDS

3. Create in IGpIniGDS a Method. HandeFile ( case sensitive ).

result type= HRESULT

Parameters

Name Type MODIFIED
full_path_to_file BSTR [IN]
event_factory IDispatch * [IN]

4. you must have a unit 'unit1' than you can save as unitIniGds ( for example).

5. Problably in this point, you can compile the project. But Nothing happend becuase not implemented the register in Google desktop and no Action defined.

What we want to do? an '.ini' indexer, so we want read the content of the ini file to pass to the google engine.

First you must to have imported the GoogleDesktopAPI2.dll library which generate a GoogleDesktopSearchAPILib_TLB.pas library with the google engine interface.

6. Open the unitIniGds.pas unit. It Implemented a Tgpinigds class which have a HandeFile method.

function Tgpinigds.HandeFile

(const full_path_to_file: WideString; const event_factory: IDispatch): HResult;

begin

end;

You must include the GoogleDesktopSearchAPILib_TLB unit in uses clause.

7. We must define the local variables of handle file as

var

factory: IGoogleDesktopSearchEventFactory;

event: IGoogleDesktopSearchEvent;

s:string;

and write the body code, some like

if FileExists(full_path_to_file) then

begin

factory:=event_factory as IGoogleDesktopSearchEventFactory;

event:=factory.CreateEvent(GuidToString(CLASS_gpinigds),'Google.Desktop.ini') as IGoogleDesktopSearchEvent;

try

s:=readStreamMax (full_path_to_file,0);

event.AddProperty('content',s); // content

event.AddProperty('format','text/html'); // format

event.AddProperty('uri',full_path_to_file); // URI

finally

event.Send(1);

end;

end;

8. Now, we want to do a register process which call to google desktop register engine to register our class.

Open the Project main unit (gooini.dll - view source).

add in uses clause the units

variants,

windows,

SysUtils,

GoogleDesktopSearchAPILib_TLB

and in betwwen uses and export clauses write

function DllRegisterServer: HResult;

var

reg: GoogleDesktopSearchRegister;

registration: IGoogleDesktopSearchComponentRegistration;

desc: Variant;

begin

if ComServ.DllRegisterServer=S_OK then

begin

desc:=VarArrayCreate([0,5],varVariant);

desc[0]:='Title';

desc[1]:='Ini indexer by Antonio Alcázar';

desc[2]:='Description';

desc[3]:='Indexes Ini Files ';

desc[4]:='Icon';

desc[5]:='';

reg:=CoGoogleDesktopSearchRegister.Create;

registration:=reg.RegisterComponent(GUIDToString(CLASS_gpinigds),desc);

registration.RegisterExtension('ini');

Result:=S_OK;

end

else

begin

Result:=E_FAIL;

end;

end;

function DllUnregisterServer: HResult;

var

reg: GoogleDesktopSearchRegister;

begin

if ComServ.DllUnregisterServer=S_OK then

begin

reg:=CoGoogleDesktopSearchRegister.Create;

reg.UnregisterComponent(GUIDToString(CLASS_gpinigds));

Result:=S_OK;

end

else

begin

Result:=E_FAIL;

end;

end;

 

Is very important than the code was situated before the export clause:

exports

DllGetClassObject,

DllCanUnloadNow,

DllRegisterServer,

DllUnregisterServer;

{$R *.TLB}

{$R *.RES}



 

 

 

 

 

   

 

 

 

Teléfono: 978-610539 - Fax: 978-610861 -Trav.Agustina Aragón 1,1e 44002 Teruel ( España ).webmaster

Copyright © 1997-2004 , [Multi-Informatica Teruel, S.L].La información contenida en este documento está sujeta a modificaciones sin previo aviso. Otros productos u organizaciones mencionadas aquí son marcas comerciales o marcas registradas propiedad de sus respectivas organizaciones o propietarios.

  Zapatec