Example 2
<% ' Search Results Section. %> <% if Request.QueryString <> "" then %> <% ' If site visitors use Outlook to view Microsoft Exchange messages, ' the Exciol control is installed on their computer. if ExchangeViewer="both" or ExchangeViewer="outlook" then %> <object id="Exciol" height=0 width=0 CLASSID="CLSID:DAFD7A40-73FF-11D1-A811-00AA006EAC9D" CODEBASE="/siteserver/knowledge/search/controls/exciol.ocx#version=5,5,2148,0" TYPE="application/x-oleobject"> </object> <script language="vbscript"> Sub DisplayMsg(EntryID) Exciol.DisplayMsg(EntryID) End Sub </script> <% end if %> <% if ExchangeViewer="both" or ExchangeViewer="owa" then %> <% ' When linking to Outlook Web Access, open the link in a new window. %> <script language="Javascript"> function openNewWindow(fileName,theWidth,theHeight) { window.open(fileName,"NewWindow","toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width="+theWidth+",height="+theHeight) } </script> <% end if %> <% ' Set query object properties. set Q = Server.CreateObject("MSSearch.Query") ' Define all required query properties: the query itself, and all columns ' that will be used in the results. Q.SetQueryFromURL(Request.QueryString) Q.Catalog = request("ct") Q.OptimizeFor="nohitcount,performance" Q.MaxRecords = 10 Q.Columns = "DocAuthor, DocTitle, DocAddress, Description, Size, FileWrite" %> <% ' The following debug information is useful as you extend this sample page. ' Set DEBUGINFO to true to see what is being passed to this page, and the ' resulting query property setting. %> <% if DEBUGINFO=true or Request("debug") <> "" then %> <p> <table cellpadding=5 border=1 bgcolor="EEEEEE"> <tr><td> <b>Useful Debug Information</b><font size=2> <p><b>QueryString passed to this page:</b> <br><% = Request.QueryString %> <p><b>Query:</b> <% = Q.Query %> <p><b>Catalogs:</b> <% = Q.Catalog %> </font></td></tr> </table> <% end if %> <hr> <% ' Create the recordset holding the search results. on error resume next set RS = Q.CreateRecordSet("sequential") if err <> 0 then createerror = err.description end if ' Log query for reporting with the Site Server Analysis feature of ' Microsoft Site Server. Only log query for first page of search results. ' if Q.StartHit = "" and Session("q1") <> "" then ' InfoToLog = "&MSS.request.Search Catalog=" & Q.Catalog & _ ' "&MSS.request.Search Start Hit=0" & _ ' "&MSS.request.Search Query="& Session("q1") ' if err or (RS.EOF and RS.BOF) then ' InfoToLog = InfoToLog & "&MSS.request.Search Row Count=0" ' else ' InfoToLog = InfoToLog & "&MSS.request.Search Row Count=0" ' end if ' ' Information to be appended cannot contain commas or spaces. ' InfoToLog = Replace(InfoToLog, " ", "%20") ' InfoToLog = Replace(InfoToLog,",","+") ' Response.AppendToLog InfoToLog ' end if ' If the query can't be executed, print out the error description. if err then Response.write " " & createerror ' If no matches are found, display a message. elseif RS.BOF and RS.EOF then Response.write "<p>" if Q.QueryIncomplete=true then L_TooComplex_Error = "The query is too complex. Try using a simpler query. For information on search syntax, see <a href=tips.htm>Search Tips</a>." Response.write L_TooComplex_Error & "<p>" else L_NoMatch_Error = "No messages matching your query were found. For suggestions on how to broaden your search, see <a href=tips.htm>Search Tips</a>." Response.write L_NoMatch_Error & "<p>" ' Display link for a new search. L_NewSearch_link = "New Search" %> <a href="Search.asp"><% = L_NewSearch_Link %></a> <% end if else ' If query could be executed, display results.