Anyone who’s navigating on Web knows the importance of a good search engine. Finding information on Web it is almost impossible nowadays without search engines. While searching the web is very common and easy these days… you cannot say the same about searching on local drives. How many times did you download again a document or application (that you knew you had it on your local drive) just because it was easier to find it on the web than on your own computer?
While some users are already using local indexing services, such as those from Google or Yahoo, the majority are not yet familiar with local search technologies. Even those that are already using out-of-the-box searching tools feel sometime the need for a little customization (eg. Web masters).
This article proposes an efficient and alternative searching method based on Microsoft Index Server and a custom ASP page. Using this method, one may index all its documents and saved web pages for easy information retrieval. Microsoft Index Server is able to search and index a wide variety of common file types: HTML documents, Office documents and PDF documents (using the free PDF IFilter plug-in from Adobe).
Start Indexing Service.
Define a catalog for your documents and saved pages (see Docs in the next image).
Define directories for this catalog. Make sure each directory has indexing enabled.
That’s all for configuration. Now come programming part. For the ease of understanding this was done in ASP (classical ASP… not ASP.NET). Any IIS server should be able to run ASP pages.
The entire implementation is done is one single ASP page and the most important piece of code that you have to write is listed below:
' Builds an SQL statement for Indexing Service
SQL = "SELECT Rank, Filename, Size, DocTitle, Path, Write, Characterization FROM Docs..Scope() " &_
"WHERE CONTAINS(" & "'" & q & "'" & ")"
If nq<>"" Then SQL = SQL & " AND NOT CONTAINS(" & "'" & nq & "'" & ")"
SQL = SQL & " ORDER BY Rank DESC"
BuildSQLQuery = SQL
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "provider=msidxs"
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.CursorLocation = adUseClient
On Error Resume Next
objRS.Open BuildSQLQuery(q,nq), objConn, adOpenKeyset,adLockReadOnly
If Err.number <> 0 or (objRS.EOF and objRS.BOF) Then Err.Clear
Response.Write "No records found!"
Set objRS = Nothing
Set objConn = Nothing
objRS.PageSize = RecordsPerPage
pag = Request.QueryString("pag")
If pag <> "" Then
pag = CInt(pag)
If pag < pag =" 1" pag =" 1" absolutepage =" pag" rowcount =" objRS.PageSize" rowonpage =" RecordsPerPage">"" then Response.Write " And Not Contains "&nq&""
Do While Not objRS.EOF And RowCount > 0
Response.Write RowOnPage & "."
RowOnPage = RowOnPage + 1
.Write "Title: " & Server.HTMLEncode(objRS.Fields("DocTitle").Value)
.Write "Filename: " & objRS.Fields("Filename").Value
.Write "Description: " & Server.HTMLEncode(objRS.Fields("characterization").Value)
.Write "URL: "
RowCount = RowCount - 1
For the sake of readability the above snippets show only the most important part of the implementation. If you are not a programmer or you just don’t feel comfortable hacking ASP pages, you may request the entire implementation for FREE.
Supposing that you are saving your code as searchdocs.asp in your web server root folder then you can your search engine by navigating to:
The following page shows a screen capture of how this custom search engine looks like. You can see that looks pretty basic… but the big advantage is that having the source code of ASP page you can customize it to feet your corporate/personal needs.
Note: HDD Search Engine is an original implementation available only through ITObserver. At this moment, it is available FREE OF CHARGE to all ITObserver Email Subscribers. If you are already an email subscriber of ITObserver you may request the web application by dropping a text or audio comment or by sending an email to vmasoft at yahoo dot com. If you are not yet a subscriber, you may subscribe now and then request the application.
Don’t forget: HDD Search Engine is just one of the benefits of being an ITObserver subscriber. The most important thing is that you’ll get fresh tech news and articles delivered directly to your email box.