Web Robot View of http://www.brettb.com/MoreIndexServerWithASP.asp

Page Item Value
Title More about Searching Index Server With ASP
Description Describes how to enhance a simple ASP script to search website content using Index Server or Indexing Service on Windows NT/2000
Keywords tutorial, example, vbscript, asp, active server page, index server, indexing services, microsoft index server
Robots Meta Tag  
Page Content   HOME | ABOUT ME | BIOTECHNOLOGY | ARTICLES | TOOLS | GALLERY | CONTACT Search: Go DEVELOPER TOOLS
ASP Doc Tool
ASP.NET Doc Tool
SQL Doc Tool
Index Server Companion
The Website Utility TECHNICAL ARTICLES
ASP
ASP.NET
JavaScript
Transact SQL

PHOTO GALLERIES
Canon EOS 300D Samples
Red Arrows 2004
Living Coasts
Web Page Backgrounds
More Galleries...

NEW STUFF
SQL Color Coder
Canon EOS 300D Samples
The Website Utility
Search Engine Optimisation
Build an ASP Search Engine
My Tropical Fishtank
Savings Other New Stuff...

POPULAR STUFF
Regular Expressions
ASP Documentation Tool
Index Server ASP
JavaScript Ad Rotator

LINKS
Business Website
ASPAlliance Articles

Home Articles

More about Searching Index Server With ASP A previous article demonstrated how ASP could be used to create a web front-end to Index Server. While the search results page demonstrated in the article contained most of what is needed to create a results page, its formatting of the search results was pretty basic, as can be seen below:

Contrast this with the search results page from this website (shown below). This demonstrates what sort of formatting can be applied to the search results. If you want to see this page in action, try the search facility on this website .

Improving the display of column properties As was described in the previous article, each search result contains a number of column properties . These contain information about each search result. In the previous article, the properties used were: FileName, doctitle, Size, Create and Characterization. As will be described below, each of these can be used to provide useful information in search results pages.

Hyperlinking the search result's filename The FileName column property contains the search result's filename (e.g. default.htm). However, a more useful column property is vpath , which also contains the file's path as well as its filename (e.g. /financial/reports/june2002/default.htm). Once the file's path is know, it is straightforward to hyperlink the search result's URL using something like the following:

Const SERVER_URL = http://www.brettb.com
Response.write b URL: /b a href= SERVER_URL oRS( vpath ) SERVER_URL oRS( vpath ) /a br

A common convention when presenting search results is to hyperlink the document's name to its URL. Index Server uses the doctitle column property to store the document's name):

Const SERVER_URL = http://www.brettb.com
Response.write b URL: /b a href= SERVER_URL oRS( vpath ) oRS( doctitle ) /a br

Displaying the search result's file size The Size column property contains the size of the file in bytes. A small formula can be used to display the file's size in Kilobytes, which is often a better unit of measure for file sizes:

Response.write b Size: /b Round(CInt(oRS( Size ))/1024, 1) K br

Displaying the document creation and modification dates The creation and modification date and time for files are contained within the Create and Write column properties, respectively. These can be formatted to display a more user friendly date by use of the FormatDateTime VBScript function as shown below:

Response.write b Create: /b FormatDateTime(oRS( Create ), 1) br
Response.write b Write: /b FormatDateTime(oRS( Write ), 1) br

Further document properties A number of other document properties may be of interest, such as HitCount (the number of words matching the query that were found in the file), and Rank (how closely the file matched the query). A more detailed description of the Rank column property is in the following section .

A complete listing of column properties is available here (it is also available in the IIS 4.0 documentation). Many properties are only of relevence if Microsoft Office documents are being indexed. Remember that if you wish to use any additional columns then they must be listed in the Columns property of the Index Server Query COM component, e.g.

oQuery.Columns = DocAuthor, vpath, doctitle, FileName, Path, Write, Size, Rank, Create, Characterization, HitCount

Displaying a file's rank The Rank column property is used as a measure of how closely a document returned by Index Server matched the search query. Rank ranges between 0 and 1000, with 1000 being the closest match. The calculation of rank is fairly complex, but a good explanation is available. To summarise, rank depends on the number of times the query terms appear in the document, as well as the number of times the query terms appear in the Index Server catalog.

In the search catalog on my own personal site, searches for ASP will return results with a low rank, because that word appears frequently (since I am an ASP developer and have lots of pages about ASP). By contrast, searches for tomato will return a high rank for the page about my biotechnology career, since it is the only page to contain numerous references to tomatoes.

In a search results page, rank can be displayed as a percentage by simply dividing the Rank by 10:

Response.write b Rank: /b CInt(oRS( Rank )/10) % br

Alternatively, it can be displayed graphically. There are a number of ways of achieving this. On my personal search page, the results are accompanied by a graphic showing from 0 to 10 filled bars, according to the rank. So a document matching with a ranking of between 700 and 800 will get 8 bars, and therefore an 80% ranking. Obviously the number of filled bars can only give an approximate ranking, but it is there as a visual aid so an accurate ranking is not important.

If you want to use the method I use, the code is below. The code should of course be executed for each page in the search results.

iCurrentRanking = oRS( Rank ) 'Retrieve the search ranking for this particular search result

If iCurrentRanking 900 Then
iRanking = 10
ElseIf iCurrentRanking 800 Then
iRanking = 9
ElseIf iCurrentRanking 700 Then
iRanking = 8
ElseIf iCurrentRanking 600 Then
iRanking = 7
ElseIf iCurrentRanking 500 Then
iRanking = 6
ElseIf iCurrentRanking 400 Then
iRanking = 5
ElseIf iCurrentRanking 300 Then
iRanking = 4
ElseIf iCurrentRanking 200 Then
iRanking = 3
ElseIf iCurrentRanking 100 Then
iRanking = 2
Else
iRanking = 1
End If

sCurrentRankingAltTag = (iRanking * 10) percent match 'Create an ALT tag for the ranking image

The appropriate rank image is then inserted using the following ASP:

img src= images/ %=iRanking% bars.png alt= %=sCurrentRankingAltTag% width= 80 height= 17

Note that the images are in the images sub-folder, and are named from 1bars.png to 10bars.png. Examples are shown below:


1bars.png


4bars.png


8bars.png


10bars.png Code samples and working ASP pages Search form and search results sample ASP files (1.23 Kb ZIP file). Fully working versions of the search form and results pages described in this article. Further reading Index Server Companion . The Index Server Companion allows Index Server to index content from remote websites and ODBC databases. Site Server 3.0 Search is not required! Searching Index Server With ASP . This article describes how to create a basic search facility by making use of Index Server from within ASP. Two related articles describe how to use the Site Server Search facility to search custom Meta Tags , and also how to use ASP to view Site Server Search catalog properties . The search facility on this website was built using Index Server and ASP using code similar to that described in this article. The Website Utility - creates a website search facility with just ASP (Index Server NOT required!) Useful Development Tools ASP Documentation Tool Automatically creates developer documentation for ASP 2.0 and 3.0 web applications written in VBScript and JScript. Documentation for Microsoft Access, SQL Server 7/2000 databases and Visual Basic 6.0 components associated with the web application can also be incorporated into the reports. Documentation is created in HTML, HTML Help and plain text formats. View Sample Output (HTML Help format).
View Sample Output (HTML Format).
Download Trial Version (5.2Mb ZIP file).
ASP.NET Documentation Tool Automatically creates developer documentation for ASP.NET web applications written in C# or VB.NET. Documentation for SQL Server 7/2000 databases and C#/VB.NET components associated with the web application can also be incorporated into the reports. Documentation is created in HTML, HTML Help and plain text formats. View Sample Output (HTML Help format).
View Sample Output (HTML Format).
Download Trial Version (2.9Mb ZIP file).
SQL Documentation Tool The SQL Documentation Tool creates technical documentation for Microsoft SQL Server 7.0 and 2000 databases. Technical documentation is created in HTML and HTML Help formats. The HTML Help format documentation is fully searchable and cross referenced. The SQL Documentation Tool documents SQL Server Tables, Views, Stored Procedures, Triggers and Table Relationships. View Sample Output (HTML Help format).
View Sample Output (HTML Format).
Download Trial Version (10.3Mb ZIP file).
Index Server Companion The Index Server Companion is a Windows application that extends the functionality of Microsoft Index Server so that it is able to index content from remote websites and also from ODBC databases. As such it can be used as a low cost alternative to Site Server 3.0 Search. View Product Documentation (119K ZIP file).
Try Sample Search Facility .
Download Trial Version (1.7Mb ZIP file).
The Website Utility The Website Utility examines websites for errors and areas that need to be optimised for search engines by using a built in web crawling engine. Errors checked for include broken or moved hyperlinks, missing page titles and missing meta tags. It also generates HTML for use in creating website site maps (table of contents pages - like this one ), and is able to create both client-side JavaScript Search Engines and server-side ASP Search Engines for a website. View Sample Output (HTML Help format).
View Sample Output (HTML Format).
Download Trial Version (3Mb ZIP file).

Site Map

All content is © 1995 - 2006 Brett Burridge

Image Alt Tags Brettb.Com
Microsoft Certified Professional
Output from SearchResults.asp
Output from an improved SearchResults.asp - as taken from my personal website
1bars.png, representing 10% match
4bars.png, representing 40% match
8bars.png, representing 80% match
10bars.png, representing 100% match
View Sample Output (HTML Help format)
View Sample Output (HTML Format)
Download Trial Version
View Sample Output (HTML Help format)
View Sample Output (HTML Format)
Download Trial Version
View Sample Output (HTML Help format)
View Sample Output (HTML Format)
Download Trial Version
View Product Documentation
Try Sample Search Facility
Download Trial Version
View Sample Output (HTML Help format)
View Sample Output (HTML Format)
Download Trial Version
ASP Documentation Tool - Free Trial Available!
1000MB and 40GB for $7.95 a month!
Internal Links http://www.brettb.com/redirector.asp (13 links in this page) [ Robot View of this URL ]
http://www.brettb.com/SearchingIndexServerWithASP.asp (4 links in this page) [ Robot View of this URL ]
http://www.brettb.com/Search.asp (3 links in this page) [ Robot View of this URL ]
http://www.brettb.com/Default.asp (3 links in this page) [ Robot View of this URL ]
http://www.brettb.com/TheWebsiteUtility.asp (3 links in this page) [ Robot View of this URL ]
http://www.brettb.com/ASPDocumentationTool.asp (2 links in this page) [ Robot View of this URL ]
http://www.brettb.com/DeveloperTools.asp (2 links in this page) [ Robot View of this URL ]
http://www.brettb.com/IndexServerCompanion.asp (2 links in this page) [ Robot View of this URL ]
http://www.brettb.com/technicalwriting.asp (2 links in this page) [ Robot View of this URL ]
http://www.brettb.com/Website_Search_Engine_Optimisation.asp [ Robot View of this URL ]
http://www.brettb.com/SearchResults.asp [ Robot View of this URL ]
http://www.brettb.com/js_banner_ad_rotator.asp [ Robot View of this URL ]
http://www.brettb.com/web.asp [ Robot View of this URL ]
http://www.brettb.com/CanonEOS300D_Gallery1.asp [ Robot View of this URL ]
http://www.brettb.com/BuildingAnASPSearchEngine.asp [ Robot View of this URL ]
http://www.brettb.com/backgrounds.asp [ Robot View of this URL ]
http://www.brettb.com/VBScriptRegularExpressions.asp [ Robot View of this URL ]
http://www.brettb.com/toc.asp [ Robot View of this URL ]
http://www.brettb.com/ASP.NETArticles.asp [ Robot View of this URL ]
http://www.brettb.com/Investments_ISAs.asp [ Robot View of this URL ]
http://www.brettb.com/SiteServerSearchCatalogProperties.asp [ Robot View of this URL ]
http://www.brettb.com/TransactSQLColorCoder.asp [ Robot View of this URL ]
http://www.brettb.com/MyTropicalFishtank.asp [ Robot View of this URL ]
http://www.brettb.com/CanonEOS300D_Gallery3.asp [ Robot View of this URL ]
http://www.brettb.com/ASPWatchArticles.asp [ Robot View of this URL ]
http://www.brettb.com/SiteServerSearchMetaTagSearching.asp [ Robot View of this URL ]
http://www.brettb.com/Red_Arrows_2004.asp [ Robot View of this URL ]
http://www.brettb.com/Living_Coasts_Photos.asp [ Robot View of this URL ]
http://www.brettb.com/SQL_Help.asp [ Robot View of this URL ]
http://www.brettb.com/contact.asp [ Robot View of this URL ]
http://www.brettb.com/Biotechnology.asp [ Robot View of this URL ]
http://www.brettb.com/Gallery.asp [ Robot View of this URL ]
http://www.brettb.com/ASPNetDocumentationTool.asp [ Robot View of this URL ]
http://www.brettb.com/gallery.asp [ Robot View of this URL ]
http://www.brettb.com/ASPAlliance/IndexServer2/SearchForm.asp [ Robot View of this URL ]
http://www.brettb.com/what's_new.asp [ Robot View of this URL ]
http://www.brettb.com/biotechnology.asp [ Robot View of this URL ]
http://www.brettb.com/JavaScriptArticles.asp [ Robot View of this URL ]
http://www.brettb.com/MoreIndexServerWithASP.asp [ Robot View of this URL ]

Reporting Main Page

Report generated by The Website Utility 2.8