More about Searching Index Server With ASP
page 3 of 4
by Brett Burridge
Feedback
Average Rating: 
Views (Total / Last 10 Days): 31623/ 66

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.

Information

Strange but true!

Oddly enough, the presentation of rankings in search results seems to be a thing of the past for most of the major search engines. Neither Google, Excite, Lycos or AltaVista display rankings. Is this evidence of the "dumbing down" of the web, or are rankings unnecessary screen clutter? Incidentally, Northern Light still display rankings in search results!

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 "Rank: " & CInt(oRS("Rank")/10) & "%
"

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:

 <%=sCurrentRankingAltTag%>

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, representing 10% match
1bars.png

4bars.png, representing 40% match
4bars.png

8bars.png, representing 80% match
8bars.png

10bars.png, representing 100% match
10bars.png


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 10/26/2014 1:54:35 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search