Visit our Sponsor   Visit our Sponsor
delphi3000.com - the free delphi knowledge platform
delphi3000.com - the free delphi knowledge platform
500 Users Online NOW
Have a look at your member-status

connecting people's knowledge


  - Recent ArticlesRSS feed for Recent Articles on delphi3000.com
  - List of All Articles
  - Top Viewed Articles
  - Articles (+Attachem.)
  - Articles Of Interest
  - Categories
  - Top Uploader
  - Search
  - Index

  - My Home
  - Submit an Article
  - My Articles
  - My Personal Data
  - My Bookmarks
  - Activities
  - Login/Logout

  - Sign Up
  - Why Sign Up
  - Newsletter

  - Press
  - Advertise

  - Contact
  - Feedback





Community
Borland
ClubeDelphi
Dr. Bob
UK-BUG
Delphi Meetings
Planeta Delphi



Loremo - the 1.5 liter car coming in 2009




Startblatt.de






Share this article with friendsShare this article with friends
Rate this articleRate this article - to keep the quality of delphi3000.com !
Comment this article or read through previous comments (6)


Using Microsoft Index Server from DelphiGo to Massimo Brini's websiteComponent available for this articleFormat this article printer-friendly!Bookmark function is only available for registered users!
Search inside an index server like a database
Product:
Delphi 5.x (or higher)
Category:
ADO/OLE-DB
Skill Level:
Scoring:
Last Update:
04/05/2002
Search Keys:
delphi delphi3000 article borland vcl code-snippet Microsoft Index Server ADO Adoconnection Adoquery Brini Massimo Delphi IIS Internet Information Server
Times Scored:
4
Visits:
5087
Uploader: Massimo Brini
Company: Dreamscape
Reference: dreamscape.it
Component Download: http://www.dreamscapeitalia.com/download/delphi_index_server.zip
 
Question/Problem/Abstract:
Many people has asked how to search inside an index server from Microsoft in order to show the results like a normal dataset. Here's how this can be done and some considerations on the use & misuse of this technology
Answer:



****************************************
Using Microsoft Index Server from Delphi
****************************************

By Massimo Brini
(c) 2002
brinim@tiscalinet.it

1. What is Index Server?
Index Server is the web-based solution choosen by Microsoft to give its IIS server the ability to search and retrieve documents; as it is concieved for use with ASP pages, it is strongly based on COM technology and in its latest release has been fully integrated also with the ADO technology.

2. First Steps
I will demonstrate how to leverage on ADO in order to search the directories of the default catalog of the main website; to search another catalog you will just change an option.
First of all you should get the Microsoft primer on Index Server at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnindex/html/msdn_is-intro.asp
With this link you wil lfind the explanation necessary to use the index server; using it is anyway easy.
To start it just go inside the Microsoft Management Console (MMC) and open inside it the services; the Microsoft Index Server Service is listed here, just right click to view the contextual menu and choose from it the "Start" option; if you want you can have it start automatically on every boot, just choose the properties of the listed item and choose "Auto Start" from the combo box.
You can have more than 1 catalog to search within; top add new catalogues you should open the MMC for IIS and work from it, but remember that this works only with Nt4/W2K server, not workstation, as in Nt4/W2K wkst only 1 web site is allowed.
BTW: The default catalog is named "WEB".

3. ADO integration
Let's get our feet wet... We will build a form with a text field and a db grid in which you will see the results of your search, just like using a normal database like access or sql server
First of all open a brand new Delphi Project; add a ADQuery & ADOConncetion couple on the form, together with a Datasource and a DBGrid. You will also need a button and a Edit component.
After these veru first steps, double click on the connectionstring property of the ADOCOnnection1 component; it will open the standard box; from the list of OLEDB Providers you should find (if your ADO is up to date) choose:
"Microsoft OleDb Provider for Indexing Services"; with a double click you will have access to the advanced options, which are already setted correctly; if you want to change the catalogue, just modify the text in the "data source" field. Click on "Test connection", everything should work.

Connect together as usual the components:
Adoquery1 -> Adoconnection1
Datasource1 -> Adoquery1
DBGRID1 -> Datasource1

I suggest of course to keep Adoconnection1.loginprompt := False and to open the connection asap (I made this at design time).

and then double click on th Button you already placed on the form in the first step; the event handler is as follows, just copy and paste:
var
  tmp: string;
begin
  if ADOQuery2.active then ADOQuery2.close;
  tmp := 'Select DocTitle, path, rank, size, Vpath, write FROM scope() WHERE CONTAINS('''+ edit1.text +''') > 0 ORDER by FileName';
  ADOQuery2.sql.text := tmp;
  ADOQuery2.Open;
end;

now you have finished: just run the application and type "note" inside the text field, it should show you 3/4 records inside the dbgrid, with the records showing the file names, path etc etc.

Easy, isn't it???

4. Pros & Cons

PROS
-You can integrate searched made on Index server and other data repositories like Access files... this can be very useful for sites based upon dynamic page creation technology.
-Zero administration
-perfect for ASP objects made in Delphi and for CGIs

CONS
- First of all there is a bug in the ADOQuery implementation by Borland, changing the SQL property of the ADOQUERY may result in error messages at design time; it is a confirmed bug, anyway everything works perfectly on runtime. So don't worry for this; maybe a patch will be given to Delphi user, otherwise you can try other ways (Using native ADO as COM objects resolve the problem)
- Second: Index Server is tigtly integrated with IIS so you can search only web catalogues, not particular directories of you file system.

The source for this example is at
http://www.dreamscapeitalia.com/download/delphi_index_server.zip





Please rate this article!
Skill level:
BeginnerExpert

Useful:
No!Very!

Overall rating:
PoorExcellent



Comments to this article
Write a new comment
more fields to display
    Miguel (Dec 18 2005 1:43AM)

I need display more information about index server, with some parameters extras.
I have description, autor, keywords, etc.
i need display in searching and thumbnails.


Respond

Don't use the Index Service
    s f (Apr 8 2002 4:04PM)

The only thing that Index Service did for my was slow down my computer.
It had slowd down my copmuter to the point where I would press the Win95 key and 5 - 10 sec later the Start Menu would apper.
Respond

RE: Don't use the Index Service
Massimo Brini (Apr 8 2002 4:10PM)

I agree at some point; IMHO it is far better to build a custom solution to index the files (I use already an Access file with inside the content of every web page - I rebuild it once every week)

It depends on your needs, anyway these article's meaning is not "use Index Server" but "How to use Index Server"

Thanks for having shared your experience with us

Massimo
Respond

question
    Eber Irigoyen (Apr 5 2002 6:29PM)

where did you get those:
DocTitle, path, rank, size, Vpath
and what are all the possible fields?
Respond

RE: question
Massimo Brini (Apr 5 2002 6:33PM)

Hi

I got those parametrs from the original Microsoft Documentation in my MSDN subscription; please note that you cannot find information about the RXW properties of a file and that you obtain a vpath = "Virtual Path", which is a path related to the web server (remember that Index Server works together with IIS)

Massimo
Respond

RE: RE: question
Klaus Edinberg (Apr 26 2002 8:24PM)

How ca I retrieve the IP WAN using a client on the lan . Means the IP adress of the WAN Connection . It will help me fully . thanks
Respond














 
Sign up to consume product discounts for Bronze memberships !

read more


  Visit our Sponsor

 

  Community Ad of
L. Rosenstein
 
   














 







     
  Copyright © 2000 - 2007 delphi3000.com - All rights reserved. Terms of use. || Privacy
delphi3000.com is a service by bluestep.com IT-Services GmbH (Vienna)