سلام
اين برنامه فقط با ويندوز 2000 كه يه Index Server3 فعال داشته باشه كار ميكنه.
<form action="search.asp" name="search.asp" id="search.asp">
Search for:
<input type="text" name="q" id="txtQuery" value="<%= strQuery %>" size="20">
<input type="submit" name="Submit" value="Search">
</form>
<%
strQuery = Request("q")
If strQuery <> "" Then
lcErrorMsg = ""
Set rs = RunQuery(strQuery, strVirtual)
if TypeName(rs) <> "Recordset" then
lcErrorMsg = "Your search returned no matching documents.
"
lcErrorMsg = lcErrorMsg & "Please try another search."
End If
Function RunQuery(lcQuery,lcVirtual)
if TypeName(lcVirtual) <> "String" then
lcVirtual = "/"
End If
if TypeName(lcQuery) <> "String" then
Set RunQuery = nothing
Exit Function
End If
Set oQ=Server.CreateObject("ixsso.Query")
oQ.query = lcQuery
' Allows you to specify which page properties are returned in the recordset
oQ.columns = "Vpath,DocTitle,Filename,Write,Characterization,DocKeyWords,Rank"
' Other properties: Contents, hitcount, Path, DocAuthor
oQ.SortBy = "Rank [d]"
oQ.MaxRecords = 100
Set oU=Server.Createobject("ixsso.util")
' Add a few directories for searching - customise for your structure.
oU.AddScopeToquery oQ,"/asphelp","shallow"
oU.AddScopeToquery oQ,"/asphelp/scripting","deep"
oU.AddScopeToquery oQ,"/asphelp/hosting","deep"
Set rs=oQ.CreateRecordset("nonsequential")
if TypeName(rs) <> "Recordset" then
Set RunQuery = nothing
exit function
End If
if rs.RecordCount < 1 then
Set RunQuery = nothing
else
' Return result RecordSet
Set RunQuery = rs
End If
End Function
%>
<% If Len(lcErrorMsg) > 0 then %>
<p>
<%= lcErrorMsg %>
<%
End If
If lcErrorMsg = "" Then
intRecordCount = rs.recordcount
intResTop = 1
intResBot = intRes + 10
If intRecordCount < intRes + 10 Then intResBot = intRecordCount
If intRes > 0 Then intResTop = intRes + 1
%>
<%= intResTop %> to <%= intResBot %> of <%= intRecordCount %> results for: "<%= strQuery %>"
<% Call WriteNav() %>
<table border="0" cellspacing="1" cellpadding="2">
<%
If intRes > 1 Then
For a = 1 to intRes
rs.MoveNext
i = i + 1
Next
End If
Do While NOT rs.eof
If rs("DocTitle") <> "" Then
strTitle = rs("DocTitle")
Else
strTitle = rs("filename")
End If
strPath = rs("vPath")
i = i + 1
b = b + 1
%>
<tr>
<td valign="top"><%= i %>. </td>
<td valign="top">
<font color="#808080"><%=Fix(rs("rank")/10)%>%</font> <a href="<%=strPath%>"><%=strTitle%></a>
<%=strPath%>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>
Summary: <%= rs("characterization") %>
<% If rs("dockeywords") <> "" Then %>
Keywords: <%= rs("dockeywords") %>
<% End If %>
Updated: <%= rs("write") %>
</td>
</tr>
<%
If b = 10 Then Exit Do
rs.MoveNext
loop
rs.Close
%>
</table>
<%
End If
Call WriteNav()
End If
'Page Navigation Display Subroutine
Sub WriteNav()
If intRecordCount > 10 Then
%>
<center>
<% If intRes > 0 Then %>
<a href="search.asp?q=<%= Server.URLEncode(strQuery) %>&s=<%= intSection %>&r=<%= intRes - 10 %>"><< Previous Page</a>
<% Else %>
<font color="#808080"><< Previous Page</font>
<%
End If
intPages = Fix(intRecordCount / 10)
If intRecordCount > (intPages * 10) Then intPages = intPages + 1
For a = 1 to intPages
If ((a * 10) - 10) = CInt(intRes) OR (a = 1 AND intRes = 0) Then
%>
<%= a %>
<% Else %>
<a href="search.asp?q=<%= Server.URLEncode(strQuery) %>&s=<%= intSection %>&r=<%= (a*10)-10 %>"><%= a %></a>
<%
End If
Next
If intRecordCount < (intRes + 10) OR intRes = 0 Then
%>
<a href="search.asp?q=<%= Server.URLEncode(strQuery) %>&s=<%= intSection %>&r=<%= intRes + 10 %>">Next Page >></a>
<% Else %>
<font color="#808080">Next Page >></font>
<% End If %>
</center>
<%
End If
End Sub
%>
ارادتمند