|
<%
Dim strQuery ' The text of our query
Dim objQuery ' The index server query object
Dim rstResults ' A recordset of results returned from I.S.
Dim objField ' Field object for loop
' Retreive the query from the querystring
strQuery = Request.QueryString("query")
' If the query isn't blank them proceed
If strQuery <> "" Then
' Create our index server object
Set objQuery = Server.CreateObject("IXSSO.Query")
' Set it's properties
With objQuery
' .Catalog = "WDDEV" ' Catalog to query
.Catalog = "WD" ' Catalog to query
.MaxRecords = 250 ' Max # of records to return
.SortBy = "rank [d]"
.Columns = "filename, path, vpath, size, write, " _
& "DocComments, DocTitle, DocAuthor, " _
& "DocKeywords, rank, hitcount"
' Build our Query: Hide admin page and FPSE pages
strQuery = "(" & strQuery & ")" _
& " AND NOT #filename = *admin*" _
& " AND NOT #filename = *content*" _
& " AND NOT #filename = *library*" _
& " AND NOT #filename = *header*" _
& " AND NOT #path *\_vti_*" _
& " AND NOT #path *\apdforms*" _
& " AND NOT #path *\Admin_Main*" _
& " AND NOT #path *\jobsinapd*" _
& " AND NOT #path *\atlord*" _
& " AND NOT #path *\title1640*" _
& " AND NOT #path *\calea*"
' Uncomment to only look for files modified last 5 days
'strQuery = strQuery & " AND @write > -5d"
.Query = strQuery ' Query text
End With
' To set more complex scopes we use the utility object.
' You can call AddScopeToQuery as many times as you need to.
' Shallow includes just files in that folder. Deep includes
' subfolders as well.
'
'Dim objUtility
'Set objUtility = Server.CreateObject("IXSSO.Util")
'objUtility.AddScopeToQuery objQuery, "c:\inetpub\wwwroot\indexserver", "shallow"
'objUtility.AddScopeToQuery objQuery, "c:\inetpub\wwwroot\indexserver\content", "shallow"
'Set objUtility = Nothing
' Get a recordset of our results back from Index Server
Set rstResults = objQuery.CreateRecordset("nonsequential")
' Get rid of our Query object
Set objQuery = Nothing
' Check for no records
If rstResults.EOF Then
Response.Write " "
Response.Write "Sorry. No results found."
Response.Write " "
Else
' Print out # of results
Response.Write ""
Response.Write rstResults.RecordCount
Response.Write " results found for: "
Response.Write Request.QueryString("query")
Response.Write " "
' Loop through results
Do While Not rstResults.EOF
' Loop through Fields
' Pretty is as pretty does... good enough:
%>
<% If rstResults.Fields("doctitle") = "" Then %>"><%= PathToVpath(rstResults.Fields("path")) %>
<% Else %>
"><%= rstResults.Fields("doctitle") %>
<% End If %>
|
Applicable To: | <%= rstResults.Fields("docauthor") %>
|
| Effective Date: | <%= rstResults.Fields("DocKeywords") %>
|
| Description: | <%= rstResults.Fields("DocComments") %>
|
<%
' Move to next result
rstResults.MoveNext
Loop
rstResults.MoveFirst
Response.Write ""
'Response.Write rstResults.GetString()
Response.Write " "
End If
' Kill our recordset object
Set rstResults = Nothing
End If
%>
<%
Function PathToVpath(strPath)
Const strWebRoot = "d:\inetpub\wwwroot\"
Dim strTemp
strTemp = strPath
strTemp = Replace(strTemp, strWebRoot, "\")
strTemp = Replace(strTemp, "\", "/")
PathToVpath = strTemp
End Function
%> |