|
Search for documents on David Hart's homepage.
<%
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 = "Web" ' Catalog to query
.MaxRecords = 100 ' Max # of records to return
.SortBy = "rank [d]"
.Columns = "filename, path, vpath, size, write, " _
& "characterization, DocTitle, DocAuthor, " _
& "DocKeywords, rank, hitcount"
.Dialect = 2
' Build our Query: Hide admin page and FPSE pages
strQuery = "(@filename *"&strQuery&"* )" _
& " AND NOT #filename = *.js*" _
& " AND NOT #filename = *admin*" _
& " AND NOT #path = *\_*" _
& " AND NOT #filename = *.log*" _
& " AND NOT #filename = *.css*" _
& " AND NOT #path = *counters*" _
& " AND NOT #path = *thumbs*" _
& " AND NOT #path = *images*" _
& " AND #path = e:\inetpub\wwwroot\dhart*" _
& " AND (#filename = *.htm*" _
& " OR #filename = *.asp*)" _
& " OR ( @contents *"&strQuery&"* )" _
& " AND NOT #filename = *.js*" _
& " AND NOT #filename = *admin*" _
& " AND NOT #path = *\_*" _
& " AND NOT #filename = *.log*" _
& " AND NOT #filename = *.css*" _
& " AND NOT #path = *counters*" _
& " AND NOT #path = *thumbs*" _
& " AND NOT #path = *images*" _
& " AND #path = e:\inetpub\wwwroot\dhart*" _
& " AND (#filename = *.htm*" _
& " OR #filename = *.asp*)" _
& " OR ( @dockeywords *"&strQuery&"* )" _
& " AND NOT #filename = *.js*" _
& " AND NOT #filename = *admin*" _
& " AND NOT #path = *\_*" _
& " AND NOT #filename = *.log*" _
& " AND NOT #filename = *.css*" _
& " AND NOT #path = *counters*" _
& " AND NOT #path = *thumbs*" _
& " AND NOT #path = *images*" _
& " AND #path = e:\inetpub\wwwroot\dhart*" _
& " AND (#filename = *.htm*" _
& " OR #filename = *.asp*)" _
& " OR ( @doctitle "&strQuery&" )" _
& " AND NOT #filename = *.js*" _
& " AND NOT #filename = *admin*" _
& " AND NOT #path = *\_*" _
& " AND NOT #filename = *.log*" _
& " AND NOT #filename = *.css*" _
& " AND NOT #path = *counters*" _
& " AND NOT #path = *thumbs*" _
& " AND NOT #path = *images*" _
& " AND #path = e:\inetpub\wwwroot\dhart*" _
& " AND (#filename = *.htm*" _
& " OR #filename = *.asp*)" _
' 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, "e:\inetpub\wwwroot\dhart", "deep"
'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 "Sorry. No results found."
Else
' Print out # of results
Response.Write "Your query of """&Request.QueryString("query")&""" returned "
Response.Write rstResults.RecordCount
Response.Write " documents: |