Forum Moderators: open
In global.asa
[6]
[/6]
Application("indexserver_ConnectionString") _
= "Provider=MSIDXS.1;Integrated Security .="""";Data Source=indexingservicename;"
In form:
[6]
[/6]
<form action="search.asp" method="get">
Search for:<br />
<input type="text" name="txtSearch" size="60" value="<%=Request("txtSearch")%>" /><br />
<input type="submit" value="Search" /><br />
Example: conventions and array<br />
<a href="searchlang.asp">Search Language</a><br />
</form><%
Sub SearchResults()
Dim rst
Dim strQuery
Dim fld
Dim nod
Dim strTitle
Dim strVPath
Dim strCharacterization
Dim strCreateDate
Dim strModifiedDate
Dim strSize
Dim astrSearchTerms
Dim iastrSearchTermsIf Not IsEmpty(Request("txtSearch")) Then
strQuery = Request("txtSearch")
astrSearchTerms = Split(strQuery)strQuery = ""
For iastrSearchTerms = LBound(astrSearchTerms) To UBound(astrSearchTerms)
If iastrSearchTerms > LBound(astrSearchTerms) Then
strQuery = strQuery & " and " & astrSearchTerms(iastrSearchTerms)
Else
strQuery = astrSearchTerms(iastrSearchTerms)
End If
Next
Set rst = Server.CreateObject("ADODB.Recordset")
rst.Source = "SELECT Characterization, Create, DocTitle, Size, VPath, Write " _
& "FROM SCOPE() WHERE CONTAINS('" & strQuery & "') ORDER BY Rank Desc"
rst.ActiveConnection = Application("indexserver_ConnectionString")
On Error Resume Next
rst.Open
If Err.number = 0 Then
On Error Goto 0
If rst.EOF Then
Call Response.Write("No pages found for '" & Server.HTMLEncode(strQuery) & "'")
Else
Call Response.Write("<ol class=""smaller"">" & vbCrLf)
Do Until rst.EOF
Call Response.Write("<li>" & vbCrLf)
With rst.Fields
If IsNull(.Item("DocTitle").value) Then
Set nod = mdomSiteMap.SelectSingleNode("/descendant::topic[attribute::path='" _
& rst("vpath") & "']")
If Not (nod Is Nothing) Then
strTitle = nod.attributes.getNamedItem("title").value
Else
strTitle = "No Title"
End If
Else
strTitle = .Item("DocTitle").Value
End If
strVPath = .Item("VPath").Value
strCharacterization = .Item("Characterization").Value
strCreateDate = FormatDateTime(.Item("Create").Value, vbShortDate)
strModifiedDate = FormatDateTime(.Item("Write").Value, vbShortDate)
strSize = CStr(.Item("Size").Value)
Call Response.Write("<a href='" & strVPath & "'>" & strTitle & "</a><br />" & vbCrLf)
Call Response.Write(strCharacterization & "...<br />" & vbCrLf)
Call Response.Write("Created: " & strCreateDate & " Last Modified: " _
& strModifiedDate & " Size: " & strSize & "<br />" & vbCrLf)
Call Response.Write("URL: " & strVPath & "<br />" & vbCrLf)
Call Response.Write("</li>" & vbCrLf)
End With
rst.MoveNext
Loop
Call Response.Write("</ol>" & vbCrLf)
End If
rst.Close
Else
Call Response.Write(Err.Description)
End If
Set rst = Nothing
End If
End SubCall SearchResults()
%>
Sorry, just noticed that you wanted ASP.NET. The above is ASP. But you get the idea. The basic scheme is that you can use SQL to query the indexing service.