%
' Force variable declaration.
Option Explicit
' Declare all our variables.
Dim strQueryText
Dim strQueryField
Dim strSQL
Dim strName
Dim strValue
Dim objRS
Dim objField
' This is the list of Index Server variables that will appear.
' You can customize the list of fields. For more information,
' see Microsoft Knowledge Base article 318387.
Const strDisplayFields = "Rank, DocAuthor, DocAppName, DocTitle, FileName, Create, Access, DocKeyWords, DocComments, Characterization, VPath"
' This is the default Index Server catalog for all Web content.
' For information about how to customize this, see Microsoft
' Knowledge Base article 318387.
Const strDataSource = "WDDEV"
' Get the value of the user-submitted search query.
strQueryText = Request("QUERYTEXT")
' Set a default value if the user has not submitted anything.
If Len(strQueryText) = 0 Then strQueryText = "N/A"
' Get the field that the user wants to query against.
strQueryField = Request("QUERYFIELD")
' Set a default value if the user has not specified a field.
If Len(strQueryField) = 0 Then strQueryField = "DocTitle"
%>
New Page 1
<%
' Build the SQL statement from the user-specified options.
strSQL = "SELECT " & strDisplayFields & " FROM SCOPE() " & _
"WHERE ((" & strQueryField & " LIKE '%" & strQueryText & "%') AND " & _
"((VPath NOT LIKE '%/_vti%') AND (VPath NOT LIKE '%/_private%')))"
' Create a recordset object.
Set objRS = Server.CreateObject("ADODB.Recordset")
' Open the recordset by using the SQL string with the Index Server provider.
objRS.Open strSQL,"PROVIDER=MSIDXS;DATA SOURCE=" & strDataSource
' Are there any records to show?
If objRS.EOF Then
' Show a default message if nothing is found.
Response.Write "No Documents were Found." & vbCrLf
' Otherwise...
Else
' Start a table.
Response.Write "" & vbCrLf
' Start the row for the header section.
Response.Write "" & vbCrLf
' Loop through the fields collection.
For Each objField in objRS.Fields
' Get the field's name.
strName = objField.Name
' If the field has a name, escape it for HTML.
If Len(strName) > 0 Then strName = Server.HTMLEncode(strName)
' Output the field name as a table header.
Response.Write "" & strName & " | " & vbCrLf
Next
' End the row for the header section.
Response.Write "
" & vbCrLf
' Loop through all the records.
While Not objRS.EOF
' Start a row in the data section.
Response.Write "" & vbCrLf
' Loop through the fields collection.
For Each objField in objRS.Fields
' Get the field's value.
strValue = objField.Value
' Look for null values.
If Len(strValue) > 0 Then
' If the value is not null, escape it for HTML.
strValue = Server.HTMLEncode(strValue)
Else
' Otherwise, make it a non-breaking space character.
strValue = " "
End If
' Output the field value as table data.
Response.Write "" & strValue & " | " & vbCrLf
Next
' End a row in the data section.
Response.Write "
" & vbCrLf
' Move on to the next record.
objRS.MoveNext
Wend
End If
%>