Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

374 lines
11 KiB

  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
  2. <HTML>
  3. <HEAD>
  4. <SCRIPT LANGUAGE="VBScript" RUNAT="Server">
  5. <!--
  6. option explicit
  7. -->
  8. </SCRIPT>
  9. <TITLE>Index Server Search Form</TITLE>
  10. <META NAME="DESCRIPTION" CONTENT="Sample query form for Microsoft Index Server">
  11. <META NAME="AUTHOR" CONTENT="Index Server Team">
  12. <META NAME="KEYWORDS" CONTENT="query, content, hit">
  13. <META NAME="SUBJECT" CONTENT="sample form">
  14. <META NAME="MS.CATEGORY" CONTENT="Internet">
  15. <META NAME="MS.LOCALE" CONTENT="EN-US">
  16. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252">
  17. <%
  18. DebugFlag = FALSE
  19. NewQuery = FALSE
  20. UseSavedQuery = FALSE
  21. SearchString = ""
  22. if Request.ServerVariables("REQUEST_METHOD") = "POST" then
  23. SearchString = Request.Form("SearchString")
  24. SortBy = Request.Form("SortBy")
  25. Colset = Request.Form("ColChoice")
  26. Scope = Request.Form("Scope")
  27. ' NOTE: this will be true only if the button is actually pushed.
  28. if Request.Form("Action") = "New Query" then
  29. NewQuery = TRUE
  30. end if
  31. end if
  32. if Request.ServerVariables("REQUEST_METHOD") = "GET" then
  33. SearchString = Request.QueryString("qu")
  34. SortBy = Request.QueryString("so")
  35. Colset = Request.QueryString("co")
  36. Scope = Request.QueryString("ix")
  37. if Request.QueryString("pg") <> "" then
  38. NextPageNumber = Request.QueryString("pg")
  39. NewQuery = FALSE
  40. UseSavedQuery = TRUE
  41. else
  42. NewQuery = SearchString <> ""
  43. end if
  44. end if
  45. %>
  46. </HEAD>
  47. <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#000066" VLINK="#808080" ALINK="#FF0000" TOPMARGIN=0>
  48. <TABLE>
  49. <TR> <TD><IMG SRC ="idx_logo.gif" ALIGN=Middle></TD>
  50. <TD VALIGN=MIDDLE><H1>Index Server</H1><BR><H2>Sample Query</H2></TD></TR>
  51. </TR>
  52. </TABLE>
  53. <HR WIDTH=75% ALIGN=center SIZE=3>
  54. <p>
  55. <FORM ACTION="query.asp" METHOD=POST>
  56. Enter your query below:
  57. <TABLE>
  58. <TR>
  59. <TD><INPUT TYPE="TEXT" NAME="SearchString" SIZE="60" MAXLENGTH="100" VALUE="<%=SearchString%>"></TD>
  60. <TD><INPUT TYPE="SUBMIT" NAME="Action" VALUE="New Query"></TD>
  61. <TD><INPUT TYPE="RESET" VALUE="Clear"></TD>
  62. </TR>
  63. <TR>
  64. <TD ALIGN=right><A HREF="/samples/search/tipshelp.htm">Tips for searching</A></TD>
  65. </TR>
  66. <INPUT TYPE="HIDDEN" NAME="SortBy" VALUE="rank[d]">
  67. <INPUT TYPE="HIDDEN" NAME="ColChoice" VALUE="1">
  68. <INPUT TYPE="HIDDEN" NAME="Scope" VALUE="/">
  69. </TABLE>
  70. </FORM>
  71. <BR>
  72. <%if DebugFlag then%>
  73. <PRE>
  74. SearchString = <%=SearchString%>
  75. SortBy = <%=SortBy%>
  76. Colset = <%=Colset%>
  77. Scope = <%=Scope%>
  78. NewQuery = <%=CStr(NewQuery)%>
  79. UseSavedQuery = <%=CStr(UseSavedQuery)%>
  80. </PRE>
  81. <%end if%>
  82. <%
  83. if NewQuery then
  84. set Session("Query") = nothing
  85. set Session("Recordset") = nothing
  86. NextRecordNumber = 1
  87. set Q = Server.CreateObject("ixsso.Query")
  88. set Util = Server.CreateObject("ixsso.Util")
  89. Q.Query = SearchString
  90. Q.SortBy = SortBy
  91. Util.AddScopeToQuery Q, Scope, "DEEP"
  92. if ColSet = 1 then
  93. Q.Columns = "filename, vpath, size, write"
  94. RecordsPerPage = 25
  95. elseif ColSet = 2 then
  96. Q.Columns = "vpath"
  97. RecordsPerPage = 200
  98. elseif ColSet = 2 then
  99. Q.Columns = "DocTitle, vpath, path, filename, size, write, characterization"
  100. RecordsPerPage = 10
  101. end if
  102. set RS = Q.CreateRecordSet("nonsequential")
  103. RS.PageSize = RecordsPerPage
  104. ActiveQuery = TRUE
  105. elseif UseSavedQuery then
  106. if IsObject( Session("Query") ) And IsObject( Session("RecordSet") ) then
  107. set Q = Session("Query")
  108. set RS = Session("RecordSet")
  109. if RS.RecordCount <> -1 and NextPageNumber <> -1 then
  110. RS.AbsolutePage = NextPageNumber
  111. NextRecordNumber = RS.AbsolutePosition
  112. end if
  113. ActiveQuery = TRUE
  114. else
  115. Response.Write "ERROR - No saved query"
  116. end if
  117. end if
  118. if ActiveQuery then
  119. if not RS.EOF then
  120. %>
  121. <p>
  122. <HR WIDTH=80% ALIGN=center SIZE=3>
  123. <p>
  124. <%
  125. LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
  126. CurrentPage = RS.AbsolutePage
  127. if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
  128. LastRecordOnPage = RS.RecordCount
  129. end if
  130. Response.Write "Documents " & NextRecordNumber & " to " & LastRecordOnPage
  131. if RS.RecordCount <> -1 then
  132. Response.Write " of " & RS.RecordCount
  133. end if
  134. Response.Write " matching the query " & chr(34) & "<I>"
  135. Response.Write SearchString & "</I>" & chr(34) & ".<P>"
  136. %>
  137. </PRE>
  138. <TABLE CELLPADDING=5 BORDER=0>
  139. <!-- BEGIN column header -->
  140. <TR>
  141. <TD ALIGN=CENTER BGCOLOR="#800000">
  142. <FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Record</FONT>
  143. </TD>
  144. <TD ALIGN=CENTER BGCOLOR="#800000">
  145. <FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>File name</FONT>
  146. </TD>
  147. <TD ALIGN=CENTER WIDTH=160 BGCOLOR="#800000">
  148. <FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Path</FONT>
  149. </TD>
  150. <TD ALIGN=CENTER BGCOLOR="#800000">
  151. <FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Size</FONT>
  152. </TD>
  153. <TD ALIGN=CENTER BGCOLOR="#800000">
  154. <FONT STYLE="ARIAL NARROW" COLOR="#ffffff" SIZE=1>Write</FONT>
  155. </TD>
  156. </TR>
  157. <%if DebugFlag then%>
  158. <PRE>
  159. RS.EOF = <%=CStr(RS.EOF)%>
  160. NextRecordNumber = <%=NextRecordNumber%>
  161. LastRecordOnPage = <%=LastRecordOnPage%>
  162. </PRE>
  163. <%end if%>
  164. <!-- BEGIN first row of query results table -->
  165. <% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage %>
  166. <TR>
  167. <TD BGCOLOR="f7efde" ALIGN=CENTER>
  168. <FONT STYLE="ARIAL NARROW" SIZE=1><%=NextRecordNumber %>.</FONT></TD>
  169. <TD BGCOLOR="f7efde" ALIGN=CENTER>
  170. <FONT STYLE="ARIAL NARROW" SIZE=1><%=RS("FileName")%></FONT></TD>
  171. <TD BGCOLOR="f7efde" ALIGN=LEFT>
  172. <FONT STYLE="ARIAL NARROW" SIZE=1><A HREF="http:<%=RS("vpath")%>"><%=RS("vpath")%></A></FONT></TD>
  173. <TD BGCOLOR="f7efde" ALIGN=CENTER>
  174. <FONT STYLE="ARIAL NARROW" SIZE=1><%=RS("Size")%></FONT></TD>
  175. <TD BGCOLOR="f7efde" ALIGN=CENTER>
  176. <FONT STYLE="ARIAL NARROW" SIZE=1><%=RS("Write")%></FONT></TD>
  177. </TR>
  178. <%
  179. RS.MoveNext
  180. NextRecordNumber = NextRecordNumber+1
  181. Loop
  182. %>
  183. </TABLE>
  184. <P><BR>
  185. <%
  186. else ' NOT RS.EOF
  187. if NextRecordNumber = 1 then
  188. Response.Write "No documents matched the query<P>"
  189. else
  190. Response.Write "No more documents in the query<P>"
  191. end if
  192. end if ' NOT RS.EOF
  193. %>
  194. <!-- If the index is out of date, display the fact -->
  195. <%if Q.OutOfDate then%>
  196. <P>
  197. <I><B>The index is out of date.</B></I><BR>
  198. <%end if%>
  199. <!--
  200. If the query was not executed because it needed to enumerate to
  201. resolve the query instead of using the index, but AllowEnumeration
  202. was TRUE, let the user know
  203. -->
  204. <%if Q.QueryIncomplete then%>
  205. <P>
  206. <I><B>The query is too expensive to complete.</B></I><BR>
  207. <%end if%>
  208. <!--
  209. If the query took too long to execute (for example, if too much work
  210. was required to resolve the query), let the user know
  211. -->
  212. <%if Q.QueryTimedOut then%>
  213. <P>
  214. <I><B>The query took too long to complete.</B></I><BR>
  215. <%end if%>
  216. <TABLE>
  217. <!--
  218. This is the "previous" button.
  219. This retrieves the previous page of documents for the query.
  220. -->
  221. <%SaveQuery = FALSE%>
  222. <%if CurrentPage > 1 and RS.RecordCount <> -1 then ' BUGBUG - use RS.Supports(adMovePrevious)%>
  223. <td align=left>
  224. <form action="query.asp" method="get">
  225. <INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
  226. <INPUT TYPE="HIDDEN" NAME="so" VALUE="<%=Q.SortBy%>">
  227. <INPUT TYPE="HIDDEN" NAME="co" VALUE="<%=ColSet%>">
  228. <INPUT TYPE="HIDDEN" NAME="ix" VALUE="<%=Q.CiScope%>">
  229. <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" >
  230. <input type="submit" value="Previous <%=RS.PageSize%> documents">
  231. </form>
  232. </td>
  233. <%SaveQuery = TRUE%>
  234. <%end if%>
  235. <!--
  236. This is the "next" button for unsorted queries.
  237. This retrieves the next page of documents for the query.
  238. This is different from the sorted version of "next" because that version
  239. can use the CiRecordsNextPage parameter for the text of the button.
  240. This variable is not available for sequential queries.
  241. -->
  242. <%if Not RS.EOF then%>
  243. <td align=right>
  244. <form action="query.asp" method="get">
  245. <INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
  246. <INPUT TYPE="HIDDEN" NAME="so" VALUE="<%=Q.SortBy%>">
  247. <INPUT TYPE="HIDDEN" NAME="co" VALUE="<%=ColSet%>">
  248. <INPUT TYPE="HIDDEN" NAME="ix" VALUE="<%=Q.CiScope%>">
  249. <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>" >
  250. <% NextString = "Next "
  251. if RS.RecordCount <> -1 then
  252. NextSet = (RS.RecordCount - NextRecordNumber) + 1
  253. if NextSet > RS.PageSize then
  254. NextSet = RS.PageSize
  255. end if
  256. NextString = NextString & NextSet & " documents"
  257. else
  258. NextString = NextString & " page of documents"
  259. end if
  260. %>
  261. <input type="submit" value="<%=NextString%>">
  262. </form>
  263. </td>
  264. <%SaveQuery = TRUE%>
  265. <%end if%>
  266. <%' if DebugFlag then%>
  267. <td align=right>
  268. <!--#include virtual="/IXSTest/srcform.inc"-->
  269. </td>
  270. <%' end if%>
  271. </TABLE>
  272. <!-- Display the page number -->
  273. Page <%=CurrentPage%>
  274. <%if RS.PageCount <> -1 then
  275. Response.Write " of " & RS.PageCount
  276. end if %>
  277. <%
  278. ' If either of the previous or back buttons were displayed, save the query
  279. ' and the recordset in session variables.
  280. if SaveQuery then
  281. set Session("Query") = Q
  282. set Session("RecordSet") = RS
  283. else
  284. RS.close
  285. Set RS = Nothing
  286. Set Q = Nothing
  287. set Session("Query") = Nothing
  288. set Session("RecordSet") = Nothing
  289. end if
  290. %>
  291. <% end if %>
  292. <p>
  293. <HR WIDTH=80% ALIGN=center SIZE=3>
  294. <p>
  295. <CENTER>
  296. <TABLE WIDTH=600 HEIGHT=50>
  297. <TR>
  298. <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=200>
  299. <font face="Arial, Helvetica" size="1">
  300. <b>
  301. Best experienced with
  302. <br>
  303. <a href="http://www.microsoft.com/ie/ie.htm"><img src="/samples/search/bestwith.gif" width="88" height="31" border="0" alt="Microsoft Internet Explorer" vspace="7"></a>
  304. <br>
  305. Click here to start.
  306. </b>
  307. </font>
  308. </TD>
  309. <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=200>
  310. <A HREF="http://www.microsoft.com/default.htm"><IMG WIDTH=175 HEIGHT=45 BORDER=0 SRC="/samples/search/home.gif"></A>
  311. </TD>
  312. <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=200>
  313. <A HREF="http://www.microsoft.com/Powered/"><IMG BORDER=0 SRC="/samples/search/powrbybo.gif" WIDTH=114 HEIGHT=43></A>
  314. </TD>
  315. </TR>
  316. </TABLE>
  317. </CENTER>
  318. <CENTER><I><FONT SIZE=-1>&copy; 1996 Microsoft Corporation</FONT></I></CENTER>
  319. <BR>
  320. <CENTER>
  321. <I><A HREF="/samples/search/disclaim.htm">Disclaimer</A></I>
  322. </CENTER>
  323. </BODY>
  324. </HTML>