![]() |
working with MS Index Server
Dear All
I want to use Ms Index Server In my delphi App. I found this code :
Delphi-Quellcode:
it works fine . but my problem is that i want to use the index server
var
Form1: TForm1; IndexQuery: TCissoQuery; IndexUtil: TCissoUtil; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var IndexServerAdmin: TAdminIndexServer; CatAdm : TCatAdm; begin //Both IndexQuery and IndexUtil objects are declared in main unit IndexQuery := TCissoQuery.Create(nil); IndexUtil := TCissoUtil.Create(nil); //Let's display a list of catalogs available on local index server IndexServerAdmin := TAdminIndexServer.Create(nil); //Check if the server is running. CheckBox1.Checked := IndexServerAdmin.IsRunning; if IndexServerAdmin.FindFirstCatalog then begin CatAdm := TCatAdm.Create(nil); CatAdm.ConnectTo(IndexServerAdmin.GetCatalog() as ICatAdm); //Add catalog name to the ListBox. ListBox1.Items.Add(CatAdm.CatalogName); CatAdm.Free; while IndexServerAdmin.FindNextCatalog do begin CatAdm := TCatAdm.Create(nil); CatAdm.ConnectTo(IndexServerAdmin.GetCatalog() as ICatAdm); //Add catalog name to the ListBox. ListBox1.Items.Add(CatAdm.CatalogName); CatAdm.Free; end; end; IndexServerAdmin.Free; end; procedure TForm1.Button1Click(Sender: TObject); var i, ii: Integer; ds: TADODataSet; rs: _Recordset; //Defined in ADOdb unit begin IndexQuery.Reset ; //Enter query text or just a word in Edit1 IndexQuery.Query := '$contents "' + Edit1.Text + '"'; //List fields you want the query to return IndexQuery.Columns := 'DocTitle,Path,Write,Rank'; //Define query result sort order IndexQuery.SortBy := 'Rank [d]'; IndexQuery.MaxRecords := 10000; //Catalog selcted in Listbox1 IndexQuery.Catalog := ListBox1.Items[ListBox1.ItemIndex]; Memo1.Lines.Clear; //Output simple status report Memo1.Lines.Add( 'Searching for ' + IndexQuery.Query + ' in "' + IndexQuery.Catalog + '"'); try ds := TADODataSet.Create(nil); //Retrieving query results - the trickiest part. ds.RecordSet := (IndexQuery.CreateRecordset('nonsequential') as _Recordset); ii := ds.Recordset.RecordCount - 1; memo1.Lines.Add('num of docs: ' + IntToStr(ii)); except memo1.Lines.Add('did not work on "' + IndexQuery.Catalog + '"'); end; //Assign Recordset object to ADODataSet's RecordSet property. ADODataSet1.RecordSet := ds.Recordset; ds.Close; ds.Free; end; on another machine via network. I used this code:
Delphi-Quellcode:
I saw all catalog in Server02 but when i want to search my keywqords an exception raised:
IndexServerAdmin:= 'server02';
There is no Catalog. what can i do? sorry for my poor german and english :( best regards apolon [edit=sakura] Replaced [code] with [delphi] ;) Mfg, sakura[/edit] |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:09 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz