Click here to Skip to main content
13,253,507 members (51,010 online)
Click here to Skip to main content
Add your own
alternative version


11 bookmarked
Posted 30 Mar 2007

How to use Microsoft Indexing Service to make search faster...

, 30 Mar 2007
Rate this:
Please Sign up or sign in to vote.
Interface of Microsoft Indexing Service with our application...


Microsoft Indexing service is like, it is making catalog for storing index of documents. and when we are searching from using Indexing service it will use those indexes which are stored into catalog, and will do search very much faster.

So here i will try to explain how we can use this Microsoft Indexing Service.

Using the code

First, we have to configure our Microsoft Indexing service to use it.

install Microsoft indexing service from the Add/Remove utility from control panel...

choose Add/Remove Windows Component --> and select Microsoft Indexing Service and install it.

Now write mmc in Start --> Run,

you will find one window which is said "Microsoft Management Console".

no do this procedure..

Click on File -->ADd/Remove Snap-in --> Add -- > select "Indexing Serivce" then --> ok --> finish.

you will see like following window..

now you have to create one catalog, which will keep track of you directory which you want to search in.

to create catalog click on "Indexing Service on Local Machine" then,

Action --> New - > catalog

Enter Name of catalog and path where you want to save the catalog files.

Your newly created catalog will be there in tree,

no just expand that node and you will see "Directories", now right click on it and select "New" --> "Directory"

Enter the path of irectory which holds your documents in which you want to perform searching operation.

Now Stop and then Start the Indexing Service, it's all, your indexing service is ready to use with your application.

// first create the OleDb connection...
System.Data.OleDb.OleDbConnection odbSearch;
System.Data.OleDb.OleDbCommand cmdSearch;
//Then prepare the Connection String to connect with the
//Indexing Server database. 
odbSearch = new System.Data.OleDb.OleDbConnection
    ("Provider=\"MSIDXS.1\";Data Source=MyDocs;Integrated Security .=");

//Instead of "MyDocs" you have to wrtie catalog name which you have created,
//from above process.

cmdSearch = new System.Data.OleDb.OleDbCommand();
cmdSearch.Connection = odbSearch;
//Now Prepare the Command Text.
cmdSearch.CommandText = 
"select doctitle, filename, vpath, rank, characterization from scope() 
where FREETEXT(Contents, '" + strSearch + "') order by rank desc ";
//Now Open the Connection.
//Now Fire the command.
OleDbDataAdapter adpt = new OleDbDataAdapter(cmdSearch);

DataSet ds = new DataSet();
DataTable dt = new DataTable();
adpt.Fill(ds, "SearchResult");
dt = ds.Tables[0];
//Thats it, DataTable "dt" will hold your Search Result you can use it now.


This Process will search only .doc,.txt, .xls files only,

For making it working for .pdf, you have to download Adobe iFilter 6.0 and simply install it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Software Developer
India India
Chirag Patel, a Programmer Analyst in a well known IT company working on .NET Technologies since last 2 years. He is interested in Pure business logic and fuzzy logic. his area of interest is in C#.NET, VB.NET and MSSQL 2005.

catch me on:

You may also be interested in...


Comments and Discussions

Questionreferences Pin
kiquenet.com9-Jun-16 23:13
memberkiquenet.com9-Jun-16 23:13 
QuestionToo slow to get the result [modified] Pin
MVini14-Jun-07 9:35
memberMVini14-Jun-07 9:35 
GeneralTo sum it up Pin
norm .net31-Mar-07 6:48
membernorm .net31-Mar-07 6:48 
GeneralGoogle API Pin
Vasudevan Deepak Kumar31-Mar-07 5:56
memberVasudevan Deepak Kumar31-Mar-07 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 31 Mar 2007
Article Copyright 2007 by JustChiragPatel
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid