是啊,用IIS自己的目录服务啊,有例程的。可以对站内全文检索。
以下的程序代码是对INDEX server基本使用方法,去除掉繁杂的分页,其实很简单的。
另外--配置IIS有些要注意的地方,你可以参考一些书。几句说不清楚的。
希望对你有帮助。
'***********
netsearchc.asp
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<script language="VBScript" RunAt="Server">
Dim SearchScope, LocaleID, QryStr
Dim ASPFile, NewQuery, UsedQuery
Dim PageSize
Dim NextPgNo, NextRecNo, CurrentPage
Dim ActiveQuery
Dim RS, Q, util
Sub Initialize()
'指定搜寻范围
SearchScope = "web"
'设定LCID(Locale Identifier)
LocaleID = "ZH-TW"
'指定每一页的资料笔数
PageSize = 10
'设定其余变数
NewQuery = FALSE
UsedQuery = FALSE
QryStr = ""
ASPFile="netsearch1.asp"
End Sub
Sub Judge_Method()
qrystr=session("qrystr")
newquery=session("newquery")
usedquery=session("usedquery")
if UsedQuery then
NextPgNo=session("NextPgNo")
end if
End Sub
Sub Init_ixsso()
Dim StrLen
if NewQuery then '若为新查询
Set Session("Query") = Nothing
Set Session("Recordset") = Nothing
NextRecNo = 1
'去除查询字符串中的左、右双引号(如果有的话)
StrLen = len(QryStr)
if left(QryStr, 1) = chr(34) then
StrLen = StrLen - 1
QryStr = right(QryStr, StrLen)
end if
if right(QryStr, 1) = chr(34) then
StrLen = StrLen - 1
QryStr = left(QryStr, StrLen)
end if
'建立Query对象及Utility对象的实例(Instance)
Set Q = Server.CreateObject("ixsso.Query")
Set util = Server.CreateObject("ixsso.Util")
'设定Query对象的相关属性
Q.Query = QryStr
Q.SortBy = "rank[d]"
Q.Columns = "DocTitle, vpath, filename, size, write, characterization, rank"
'指定传回的最大笔数
Q.MaxRecords = 200
Q.catalog=searchscope
if LocaleID <>"" then
Q.LocaleID = util.ISOToLocaleID(LocaleID)
end if
'以NonSequential之模式建立RecordSet
set RS = Q.CreateRecordSet("nonsequential")
'每一页固定10笔
RS.PageSize = PageSize
ActiveQuery = TRUE
ElseIf UsedQuery then
if IsObject( Session("Query") ) And _
IsObject( Session("RecordSet") ) then
set Q = Session("Query")
set RS = Session("RecordSet")
if RS.RecordCount <> -1 and NextPgNo <> -1 then
RS.AbsolutePage = NextPgNo
NextRecNo = RS.AbsolutePosition
end if
ActiveQuery = TRUE
else
Response.Write "错误 - 尚无任何查询条件!"
end if
End If 'NewQuery
End Sub
Sub Show_Query()
Dim LastRecordOnPage
'若为现有查询
if ActiveQuery then
'如果Record set有值,就一一取出,然后显示于前端浏览器
if not RS.EOF then
LastRecordOnPage = NextRecNo + RS.PageSize - 1
CurrentPage = RS.AbsolutePage
if RS.RecordCount <> -1 AND _
RS.RecordCount < LastRecordOnPage then
LastRecordOnPage = RS.RecordCount
end if
'显示视窗目前的资料编号
Response.Write "<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font size=2 style='font-size:10.5pt'>文件" & NextRecNo & " 至 "
Response.Write LastRecordOnPage & ", "
'取出总笔数
if RS.RecordCount <> -1 then
Response.Write "总共有<font color='red' size=2><b>"
Response.Write RS.RecordCount & "</b></font>"
end if
Response.Write "笔纪录符合查询条件:" & chr(34) & "<b>"
Response.Write QryStr & "</b>" & chr(34) & "。<P>"
if Not RS.EOF and NextRecNo <= LastRecordOnPage then
Response.Write "<table border=0 width=74%>"
Response.Write "<colgroup width=90>"
end if
Do While Not RS.EOF and NextRecNo <= LastRecordOnPage
'一一显示文件的标题、摘要、URL、文件大小及
'最后修改日期。
Response.Write "<p>"
Response.Write "<tr class='RecordTitle'>"
Response.Write "<td align=right valign=top "
Response.Write "BGCOLOR='#ffffff' class='RecordTitle'>"
'显示编号
Response.Write NextRecNo & "."
Response.Write "</td>"
Response.Write "<td BGCOLOR='#e6f2ff'>"
'Response.Write "<b class='RecordTitle'>"
'如果标题属性(Title)存在的话就显示Title,
'否则显示出文件名
if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then
Response.Write "<font size=2>"
Response.Write "<class='RecordTitle'><a href='#' onClick=MM_openBrWindow('"
Response.write rs("vpath") & "','','')>"
Response.Write Server.HTMLEncode(RS("filename")) & "</a> <font>"
else
Response.Write "<font size=2>"
Response.Write "<class='RecordTitle'><a href='#' onClick=MM_openBrWindow('"
Response.write rs("vpath") & "','','')>"
Response.Write Server.HTMLEncode(RS("DocTitle")) & "</a> <font>"
end if
'Response.Write "</b>"
Response.Write "</td></tr>"
Response.Write "<tr>"
Response.Write "<td>"
Response.Write "</td>"
Response.Write "<td valign=top>"
'显示摘要
Response.Write "<font size=2>"
if VarType(RS("characterization")) = 8 and _
RS("characterization") <> "" then
Response.Write "摘要:"
Response.Write Server.HTMLEncode(RS("characterization"))
end if
Response.Write "<br>"
Response.Write "<class='RecordStats'><a href='#' onClick=MM_openBrWindow('"
Response.write rs("vpath") & "','','')>"
Response.Write "http://"
Response.Write Request("server_name") & RS("vpath")
Response.Write "</font>"
Response.Write "</a><br>"
Response.Write "<font size=2>"
if RS("size") = "" then
Response.Write "(大小和时间不详)"
else
Response.Write "大小 " & RS("size") & " 个字节 - "
Response.Write RS("write") & " GMT"
end if
Response.write "</font>"
'Response.Write "</i>"
Response.Write "</td></tr>"
Response.Write "<tr><td>&nbsp;&nbsp;</td></tr>"
RS.MoveNext
NextRecNo = NextRecNo + 1
Response.Write "<p>"
Loop
Response.Write "</font>"
Response.Write "</table>"
Response.Write "<P><BR>"
else ' RS.EOF
if NextRecNo = 1 then
Response.Write "没有任何文件符合查询条件!<P>"
else
Response.Write "符合查询条件的文件均已显示!<P>"
end if
end if ' NOT RS.EOF
if Q.OutOfDate then
Response.Write "<P align='center' style='font-size:9pt'>检索即将过期"
Response.Write "(out of date)。<BR>"
end if
if Q.QueryIncomplete then
Response.Write "<P><I><B>查询无法完整完成"
Response.Write "(Query Incomplete)。</B></I><BR>"
end if
if Q.QueryTimedOut then
Response.Write "<P><I><B>查询时间太长"
Response.Write "(Time out)。</B></I><BR>"
end if
'
Call Show_Button()
end if 'ActiveQuery
End Sub
Sub Show_Button()
Dim SaveQuery
Response.Write "<TABLE>"
'显示「前X份文件」按钮
SaveQuery = FALSE
if CurrentPage > 1 and RS.RecordCount <> -1 then
Response.Write "<td align=left>"
Response.Write "<form action='" & ASPFile & "' method='get'>"
Response.Write "<INPUT TYPE='HIDDEN' NAME='qu' "
Response.Write "VALUE='" & QryStr & "'>"
Response.Write "<INPUT TYPE='HIDDEN' NAME='sc' "
Response.Write "VALUE='" & SearchScope & "'>"
Response.Write "<INPUT TYPE='HIDDEN' name='pg' "
Response.Write "VALUE='" & CurrentPage-1 & "'>"
Response.Write "<input style='font-size:9pt' type='submit' value='前 "
Response.Write RS.PageSize & " 份文件'>"
Response.Write "</form>"
Response.Write "</td>"
SaveQuery = TRUE
end if
'显示「後X份文件」按钮
if Not RS.EOF then
Response.Write "<td align=right>"
Response.Write "<form action='" & ASPFile & "' method='get'>"
Response.Write "<INPUT TYPE='HIDDEN' NAME='qu' "
Response.Write "VALUE='" & QryStr & "'>"
Response.Write "<INPUT TYPE='HIDDEN' NAME='sc' "
Response.Write "VALUE='" & SearchScope & "'>"
Response.Write "<INPUT TYPE='HIDDEN' name='pg' "
Response.Write "VALUE='" & CurrentPage+1 & "'>"
NextString = "后 "
if RS.RecordCount <> -1 then
NextSet = (RS.RecordCount - NextRecNo) + 1
if NextSet > RS.PageSize then
NextSet = RS.PageSize
end if
NextString = NextString & NextSet & " 份文件"
else
NextString = NextString & " 页文件"
end if
Response.Write "<input type='submit' style='font-size:9pt' "
Response.Write "value='" & NextString & "'>"
Response.Write "</form>"
Response.Write "</td>"
SaveQuery = TRUE
end if 'Not RS.EOF
Response.Write "</TABLE>"
'显示「目前页数/总页数」
Response.Write "页数 : " & CurrentPage
if RS.PageCount <> -1 then
Response.Write " / " & RS.PageCount
end if
'如果有「前十份文件」或「后X份文件」按钮存在的话,
'就将现有的Query对象及Recordset存到Session变量中,
'以备按下前两个按钮之用
if SaveQuery then
set Session("Query") = Q
set Session("RecordSet") = RS
Session("ShowFrame")=false
else '否则关闭并清除
RS.close
Set RS = Nothing
Set Q = Nothing
set Session("Query") = Nothing
set Session("RecordSet") = Nothing
Session("ShowFrame")=true
end if
End Sub
</script>
<HTML>
<HEAD>
<title>站内搜索</title>
</HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<body bgcolor="#FFFFFF">
<%
Call Initialize()
Call Judge_Method()
%>
<%
Call Init_ixsso()
Call Show_Query()
%>
</table>
</BODY></HTML>
'*******************
netsearch1.asp
<html>
<head>
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
'取出使用者输入的查询字符串
QryStr = Request.Form("netqry")
'是否按下「执行」钮
NewQuery = TRUE '为一新查询
session("showframe")=true
end if
if Request.ServerVariables("REQUEST_METHOD") = "GET" then
'取出Hidden属性的栏内容
QryStr = Request.QueryString("qu")
SearchScope = Request.QueryString("sc")
if Request.QueryString("pg") <> "" then
NextPgNo = Request.QueryString("pg")
NewQuery = FALSE
UsedQuery = TRUE
session("NextPgNo")=NextPgNo
else
NewQuery = QryStr <> ""
end if
end if
session("qrystr")=qrystr
session("newquery")=newquery
session("usedquery")=usedquery
%>
<title>-- </title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<%
if session("showframe") then
Response.Write "<frameset rows='20*,20' frameborder='NO' border='0' framespacing='0' cols='*'> "
Response.Write "<frameset cols='151,643*' frameborder='NO' border='0' framespacing='0' rows='*'> "
Response.Write " <frame name='leftFrame' scrolling='NO' noresize src='../left1.htm'> "
Response.Write "<frame name='mainFrame' src='../search/netsearchc.asp'> "
Response.Write "</frameset>"
Response.Write "<frame name='bottomFrame' scrolling='NO' noresize src=' ../botton.htm'> "
Response.Write "</frameset>"
else
Response.Redirect "netsearchc.asp"
end if
%>
</html>