% 'Insure that the user enters a search string otherwise redirect to an error page If Request.Form("NewQuery") = "TRUE" and Request.Form("SearchString")= "" then Response.Redirect("error.html") End If 'If the request is a new query then set initial variables and set up the query object If Request.Form("NewQuery") = "TRUE" then NewQuery = TRUE RankBase = 1000 SearchString = Request.Form("SearchString") CurrentPage = 1 Else NewQuery = FALSE End If 'If the request is a continuation of an existing query then read in existing variables If Request.Form("SavedQuery") = "TRUE" then SavedQuery = TRUE RankBase = cint(Request.Form("RankBase")) SearchString = Request.Form("SearchString") CurrentPage = cint(Request.Form("CurrentPage")) Else SavedQuery = FALSE End If If NewQuery = TRUE or SavedQuery = TRUE then 'Set initial query parameters Catalog = "Renewal" SortBy = "rank[d]" Columns = "doctitle, vpath, filename, size, write, characterization, rank" AllowEnumeration = FALSE SiteLocale = "EN-US" MaxRecords = 300 OptimizeFor = "recall" PageSize = 10 FormScope = "/" FormDepth = "deep" RecordSetType = "nonsequential" 'Remove any quotes from the search string SearchString = Replace(SearchString, chr(34), "") End If 'If the request is a new query then instantiate the query object If NewQuery = TRUE then set Q = Server.CreateObject("IXSSO.Query") set util = Server.CreateObject("IXSSO.Util") Q.Catalog = Catalog Q.Query = "(! #vpath *_\vti_*.) and (@doctitle > " + chr(34) + chr(34) + ") and (@filename > " + chr(34) + chr(34) + ") and (" + SearchString + ")" Q.SortBy = SortBy Q.Columns = Columns Q.AllowEnumeration = AllowEnumeration If SiteLocale <> "" then Q.LocaleID = util.ISOToLocaleID(SiteLocale) End If Q.MaxRecords = MaxRecords Q.OptimizeFor = OptimizeFor If FormScope <> "/" then util.AddScopeToQuery Q, FormScope, FormDepth End If End If 'If the request is a continuation of an existing query then read in the query object from session variables If SavedQuery = TRUE then If isObject(Session("Query")) and IsObject(Session("RecordSet")) and isObject(Session("util")) then set Q = Session("Query") set util = Session("util") set RS = Session("RecordSet") RS.AbsolutePage = CurrentPage Else Response.Write("ERROR - No saved query.") End If End If Function ShowResults() On Error Resume Next 'Run the query set RS=Q.CreateRecordSet(RecordSetType) RS.PageSize = PageSize 'If the query fails display an error otherwise display the results If RS.EOF then If Q.QueryIncomplete then Response.Write("The query is too expensive to complete." + chr(13)) ElseIf Q.QueryTimedOut then Response.Write("The query took too long to complete." + chr(13)) Else Response.Write("No documents matched the query." + chr(13)) End If Else 'Dynamicly build a results list in table format Response.Write("
| " + cstr(RS.AbsolutePosition - RecordOffset) + chr(13))
Response.Write(" | " + chr(13))
If VarType(RS("doctitle")) = 1 or RS("doctitle") = "" then
Response.Write(" " + cstr(RS("filename")) + " " + chr(13)) Else Response.Write(" | " + cstr(RS("doctitle")) + " " + chr(13)) End If If VarType(RS("characterization")) = 8 and RS("characterization") <> "" then Response.Write("Abstract: " + Server.HTMLEncode(RS("characterization")) + " " + chr(13)) End If Response.Write("http://" + Request("server_name") + cstr(RS("vpath")) + " " + chr(13)) If RS("size") = "" then Response.Write("(size and time unknown)") Else Response.Write("size " + cstr(RS("size")) + " bytes - " + cstr(RS("write")) + " GMT" + chr(13)) End If Response.Write(" " + chr(13)) Response.Write(" |