创建ASP页面
在ASP页面上一切都变得非常酷。你用表单中的值来驱动对索引服务器进行查询的对象。
整个过程是这样的:
◆ 打开记录集。
◆ 用标准ADO 方法,一步步地走过记录集。
1
2"Create a Query object, initialize it using
3"SetQueryFromURL, and dump the object state
4
5"set the query object
6Set objQuery = Server.CreateObject("ixsso.Query")
7
8"get the query properties set from the
9"incoming URL (from the form GET operation)
10objQuery.SetQueryFromURL(Request.QueryString)
11
12"tell the object what columns to include
13objquery.columns="filename,HitCount,vpath,DocTitle,characterization"
14
15"open the recordset, causing the query to be
16"executed
17set rsQuery = objquery.createrecordset("nonsequential")
18
19"now, if rsquery.eof is not TRUE, then we have results
20"to show. If it IS TRUE, no results were found.
21
22"get the page out for the user...
1<html>
2<head>
3</head>
4<h1>Search Results</h1>
5A maximum of 200 results will be returned, 20 hits per page will be shown. <br/><br/>
if not rsquery.eof then
Response.Write rsquery.recordcount & " hit(s) were found. "
if rsquery.recordcount > 30 then
Response.Write "You may want to refine your query."
end if
Response.Write "<br/>"
end if
1
if not rsquery.eof then
while not rsquery.eof and rowcount > 0
if rsquery("doctitle") <> "" then
Response.Write "<p><b><a ""="" &="" href="" rsquery("vpath")="">" & rsquery("doctitle") & "</a></b><br/>"
response.write "<font size="-1">" & rsquery("characterization") & "...</font><br/>"
Response.Write "<font 2="" size="-">" & rsquery("hitcount") & " hit(s)</font></p>"
end if
rowcount = rowcount - 1
rsquery.movenext
wend
Response.Write "<br/><br/>"
1
2
else
1
2<p>
3对不起,没有发现纪录,如果要查询两个以上的词,使用and或or。
4</p>
5
end if
1
2
3</html>
你需要做的第一件事就是建立对索引服务器对象的引用。这是通过使用server.creatobject方法来完成的:
Set objQuery = Server.CreateObject("ixsso.Query")
作者/出处:青苹果工作室