' Code to accompany Rob Macdonald's Sep 98 feature on Index Server with ADO ' sample query SELECT DocAppName, DocTitle, DocWordCount, HitCount FROM SCOPE(' "/IISSamples/ISSamples" ') WHERE CONTAINS(' "object" near() "oriented"') > 0 ORDER BY HitCount DESC ' Listing 1. Using ADO and Index Server from VB. Private Sub Form_Load() On Error Resume Next ListView1.ColumnHeaders.Add , , "Title", 2000 ListView1.ColumnHeaders.Add , , "Hits", 500 ListView1.ColumnHeaders.Add , , "Application", 1500 ListView1.ColumnHeaders.Add , , "Path", 5000 Set rs = CreateObject("ADODB.Recordset") sCommand = "SELECT " & _ " DocTitle,DocAppName,Path,HitCount" & _ " FROM SCOPE(' ""/IISSamples/ISSamples"" ') " & _ " WHERE CONTAINS(' ""RDO"" ')> 0 " & _ " ORDER BY HitCount DESC" rs.Open sCommand, "Provider=MSIDXS" While Not rs.EOF Set Item = ListView1.ListItems.Add(, , rs_ ("DocTitle")) Item.SubItems(1) = rs("HitCount") Item.SubItems(2) = rs("DocAppName") Item.SubItems(3) = rs("Path") rs.MoveNext Wend End Sub ' Listing 2. The ASP equivalent of Listing 1. ADO / Index Server Document Search Page <% Set rs = Server.CreateObject("ADODB.Recordset") sCommand = "SELECT " & _ " DocTitle, Path, DocAppName, HitCount" & _ " FROM SCOPE(' ""/IISSamples/ISSamples"" ')" & _ " WHERE CONTAINS(' ""RDO"" ')>0" & _ " ORDER BY HitCount DESC" rs.Open sCommand, "Provider=MSIDXS" While Not rs.EOF %>
<% = rs("DocTitle") & " " %> (<% = rs("HitCount") %>) <% = rs("DocAppName") & " " %> <% = rs("Path") & " " %>
<% rs.MoveNext Wend %> ' code fragment showing remote browser access
> <% = rs("DocTitle") & " " %> (<% = rs("HitCount") %>) <% = rs("DocAppName") & " " %>