Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Win32/Win64 API (native code) (https://www.delphipraxis.net/17-win32-win64-api-native-code/)
-   -   Delphi working with MS Index Server (https://www.delphipraxis.net/25637-working-ms-index-server.html)

apolon 9. Jul 2004 16:41


working with MS Index Server
 
Dear All

I want to use Ms Index Server In my delphi App.
I found this code :
Delphi-Quellcode:
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;
it works fine . but my problem is that i want to use the index server
on another machine via network.
I used this code:
Delphi-Quellcode:
IndexServerAdmin:= 'server02';
I saw all catalog in Server02 but when i want to search my keywqords an exception raised:
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