|
<% ' Search Results Section. %>
<%
Dim Q, RS, i, RN
Dim RecordNumber, pagecount, DocTitle
If Request("qu") <> "" Then
If Request("RN") = "" Then
RecordNumber=1
Else
RecordNumber=Request("RN")
End If
' Create the Query Object, and set properties for the search.
set Q = Server.CreateObject("MSSearch.Query")
Q.SetQueryFromURL(Request.QueryString)
Q.SortBy = "rank[d]"
Q.MaxRecords = 20
Q.Catalog = Request("ct")
Q.Columns = "DocTitle, DocAddress, SiteName, MimeType, NNTP_MessageID, Rank"
' Execute the query and create the recordset holding the search results.
On Error Resume Next
Set RS = Q.CreateRecordSet("sequential")
' If the query can't be executed, print out the error description.
If Err.Number <> 0 Then
Response.Write "" & L_ReservedWords_Text & ""
Elseif RS.EOF = true and RS.BOF = true Then
If Q.QueryIncomplete = TRUE Then
Response.Write "" & L_TooComplex_Text & ""
Else
Response.Write "" & L_NoMatches_Text & ""
End if
Else
%>
<% ' Set up the header table for displaying results summary. %>
<% = L_Matches_text %>:
<% if RS.Properties("RowLimitExceeded") = true then
Response.write L_MoreThan_text & " " & RS.Properties("RowCount")
else
Response.write RS.Properties("RowCount")
end if %>
|
<% = L_Query_text %>: <% = Request("qu") %>
|
|
<% = L_Displayed_text %>: <% = RecordNumber %> -
<% If RS.Properties("RowCount") < RecordNumber + 19 Then %>
<% = RS.Properties("RowCount") %>
<% Else %>
<% = RecordNumber + 19 %>
<% End If %>
|
<% = L_ResultLinks_text %>:
<%
pagecount = RS.Properties("RowCount") \ Q.MaxRecords
If RS.Properties("RowCount") mod Q.MaxRecords > 0 Then
pagecount=pagecount +1
End If
for i=1 to pagecount
Q.StartHit = Q.MaxRecords * (i - 1)
RN = Q.MaxRecords * (i - 1) + 1
response.write "" _
& i & " "
next
if RS.Properties("RowLimitExceeded") = true then
Q.StartHit = Q.MaxRecords * i
response.write "" _
& i & " . . ."
else
end if
%>
|
<% ' Set up loop to iterate through results.
Do while not RS.EOF
' If a blank title is found, use the address instead.
If RS("DocTitle") <> "" Then
DocTitle = RS("DocTitle")
Else
DocTitle = "No title: " & RS("DocAddress")
End If
%>
<% = RecordNumber %>.
|
<% if RS("NNTP_MessageID") <> "" then %>
<%
Dim strLink
strLink = "news://" & RS("SiteName") & "/" & RS("NNTP_MessageID")
%>
<% = DocTitle %>
<% Else %>
<% = cint(RS("Rank"))/10%>% "><% = DocTitle %> <% = RS("DocAddress")%>
<% End if %>
|
<% ' Increment the results.
RS.MoveNext
RecordNumber = RecordNumber + 1
Loop
%>
<% End If ' End of check for successful recordset creation. %>
<% End If ' End of Results Section. %>
|
|