Suchen<%@ Language="VBScript" %>
<% Option Explicit %>
This is the search page of the sample web content for ASP 101's
Index Server article.
Queries that should return results include:
form, search, etc.
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
.Catalog = "IS-Sample" ' Catalog to query
.Query = strQuery ' Query text
.MaxRecords = 10 ' Max # of records to return
' What to sort records by. I'm sorting by rank [d]
' which is [d]escending by how pertinent Index Server
' thinks the result is. This way the most applicable
' result should be first.
.SortBy = "rank [d]"
' Which columns to return. Column names must
' be the same as the catalog's properties. Some
' of them are: contents, filename, size, path,
' vpath, hitcount, rank, create, write, DocTitle
' DocSubject, DocAuthor, DocKeywords...
.Columns = "filename, path, vpath, size, write, " _
& "characterization, DocTitle, DocAuthor, " _
& "DocKeywords, rank, hitcount"
' 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."
' Print out # of results
Response.Write " results found:"
' Loop through results
Do While Not rstResults.EOF
' Loop through Fields
' Formatting leaves something to be desired,
' but it'll work for now. We'll pretty things
' up and link to the content in part II.
For Each objField in rstResults.Fields
Response.Write ": "
' Spacing between results
' Move to next result
' Kill our recordset object
Set rstResults = Nothing