C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Articles » ASP.NET/Web Applications »

Including Search for your website documents -Part 2


Posted Date: 04 Oct 2005    Resource Type: Articles    Category: ASP.NET/Web Applications
Author: Harish RanganathanMember Level: Gold    
Rating: 1 out of 5Points: 10



Introduction


If you have come to this article without reading the Part 1, please check Part 1

Once you have created the Catalog for your Search, you can use the Catalog for searching.



Using the Catalog in your Application



1. In your Search Page, have a Textbox (TextBox1) and a Button (Button1).

2. In the click event of the Button, put the following code.


string strCatalog = ;

strQuery = "Select Filename from Scope() where FREETEXT('" + TextBox1.Text + "')";

string connstring = "Provider=MSIDXS.1;Integrated Security .='';Data Source="+ strCatalog;

OleDbConnection objconn = new OleDbConnection(connstring);

OleDbCommand objcmd = new OleDbCommand(strQuery, objconn);

OleDbDataReader objRdr=null;
objconn.Open();
objRdr=objcmd.ExecuteReader();

if(objRdr.HasRows)
{
while(objRdr.Read())
{
docname += objRdr["Filename"].ToString() + ",";
}
docname=docname.Remove(docname.Length-1,1);
}
}



Now "docname" has a comma separated list of file names containing the search text.

You can have an XML File or a Database table with Nodes/Fields - FileName, a Heading and a Description, which you can use to look up for the document name and get the desired results for displaying in your Page.

This way, you can implement search for your website without writing the logic for search.

This article applies to Windows 2000, Windows XP and Windows 2003

Note:
If you would like to search for PDF Files, you need to install the PDF Filter for Indexing Service which helps the Indexing Service in searching within PDF Files. Its a freeware download and can be downloaded from http://www.adobe.com/support/downloads/detail.jsp?ftpID=2611

Summary


This completes the 2 part article on implementing search for website documents using Microsoft Indexing Services.



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Including Search for your website documents -Part 1
Previous Resource: Assigning the text value for a Password Textbox
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET/Web Applications


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use