一個方法是利用Index Server query object和參數:
<%
Set Q= Sever.CreatObject("ixsso.Query")
' 創建查詢對象.
Set Util= Sever.CreatObject("ixsso.Util")
Q.Query= Request("SearchString")
' 查詢字段.
Q.SortBy="rank[d] "
' 按照符合程度降序排列
Q.Columns="Doctitle,vpath,filename,size,write,characterization,rank"
' 返回記錄屬性.
Q.MaxRecords=300
' 最多返回記錄數.
Util.AddScopeToQuery Q, "/","DEEP"
' 搜索所有子目錄.
Q.LocaleID=Util.ISOToLocaleID(“ZH-CN”)
' 指定所用語言為簡體中文.
Set RS = Q.CreateRecordSet("nonsequential")
' 創建輸出集.
%>
另一個方法就是.利用ADO query object和SQL語句:
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.ConnectionString = "provider=msidxs;"
Conn.Open
Set AdoCommand = Server.CreateObject("ADODB.Command")
Set AdoCommand.ActiveConnection = Conn
AdoCommand.CommandText = "Select Doctitle,vpath,filename,size,write, "&"characterization,rank from SCOPE() WHERE CONTAINS (` "&SearchString &"`) ORDER BY rank DESC"
Set RS = Server.CreateObject("ADODB.RecordSet")
RS.open AdoCommand
%>