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.

357 lines
10 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 ="/samples/search/book08.jpg" 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. Q.Query = SearchString
  89. Q.SortBy = SortBy
  90. Q.AddScopeToQuery Scope, "DEEP"
  91. if ColSet = 1 then
  92. Q.Columns = "DocTitle, vpath, path, filename, size, write, characterization"
  93. RecordsPerPage = 10
  94. elseif ColSet = 2 then
  95. Q.Columns = "vpath, path"
  96. RecordsPerPage = 200
  97. elseif ColSet = 3 then
  98. Q.Columns = "filename, vpath, size, write"
  99. RecordsPerPage = 25
  100. end if
  101. set RS = Q.CreateRecordSet("nonsequential")
  102. RS.PageSize = RecordsPerPage
  103. ActiveQuery = TRUE
  104. elseif UseSavedQuery then
  105. if IsObject( Session("Query") ) And IsObject( Session("RecordSet") ) then
  106. set Q = Session("Query")
  107. set RS = Session("RecordSet")
  108. if RS.RecordCount <> -1 and NextPageNumber <> -1 then
  109. RS.AbsolutePage = NextPageNumber
  110. NextRecordNumber = RS.AbsolutePosition
  111. end if
  112. ActiveQuery = TRUE
  113. else
  114. Response.Write "ERROR - No saved query"
  115. end if
  116. end if
  117. if ActiveQuery then
  118. if not RS.EOF then
  119. %>
  120. <p>
  121. <HR WIDTH=80% ALIGN=center SIZE=3>
  122. <p>
  123. <%
  124. LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
  125. CurrentPage = RS.AbsolutePage
  126. if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
  127. LastRecordOnPage = RS.RecordCount
  128. end if
  129. Response.Write "Documents " & NextRecordNumber & " to " & LastRecordOnPage
  130. if RS.RecordCount <> -1 then
  131. Response.Write " of " & RS.RecordCount
  132. end if
  133. Response.Write " matching the query " & chr(34) & "<I>"
  134. Response.Write SearchString & "</I>" & chr(34) & ".<P>"
  135. %>
  136. </PRE>
  137. <!-- BEGIN column header -->
  138. <% if ColSet = 1 then%>
  139. <!--#include virtual="/srchasp/qryhead1.inc"-->
  140. <% elseif ColSet = 2 then%>
  141. <!--#include virtual="/srchasp/qryhead2.inc"-->
  142. <% elseif ColSet = 3 then%>
  143. <!--#include virtual="/srchasp/qryhead3.inc"-->
  144. <% end if%>
  145. <%if DebugFlag then%>
  146. <PRE>
  147. RS.EOF = <%=CStr(RS.EOF)%>
  148. NextRecordNumber = <%=NextRecordNumber%>
  149. LastRecordOnPage = <%=LastRecordOnPage%>
  150. </PRE>
  151. <%end if%>
  152. <!-- BEGIN first row of query results table -->
  153. <% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage %>
  154. <% if ColSet = 1 then%>
  155. <!--#include virtual="/srchasp/qrybody1.inc"-->
  156. <% elseif ColSet = 2 then%>
  157. <!--#include virtual="/srchasp/qrybody2.inc"-->
  158. <% elseif ColSet = 3 then%>
  159. <!--#include virtual="/srchasp/qrybody3.inc"-->
  160. <% end if%>
  161. <%
  162. RS.MoveNext
  163. NextRecordNumber = NextRecordNumber+1
  164. Loop
  165. %>
  166. <% if ColSet = 1 then%>
  167. <!--#include virtual="/srchasp/qrytail1.inc"-->
  168. <% elseif ColSet = 2 then%>
  169. <!--#include virtual="/srchasp/qrytail2.inc"-->
  170. <% elseif ColSet = 3 then%>
  171. <!--#include virtual="/srchasp/qrytail3.inc"-->
  172. <% end if%>
  173. <P><BR>
  174. <%
  175. else ' NOT RS.EOF
  176. if NextRecordNumber = 1 then
  177. Response.Write "No documents matched the query<P>"
  178. else
  179. Response.Write "No more documents in the query<P>"
  180. end if
  181. end if ' NOT RS.EOF
  182. %>
  183. <!-- If the index is out of date, display the fact -->
  184. <%if Q.CiOutOfDate then%>
  185. <P>
  186. <I><B>The index is out of date.</B></I><BR>
  187. <%end if%>
  188. <!--
  189. If the query was not executed because it needed to enumerate to
  190. resolve the query instead of using the index, but AllowEnumeration
  191. was FALSE, let the user know
  192. -->
  193. <%if Q.CiQueryIncomplete then%>
  194. <P>
  195. <I><B>The query is too expensive to complete.</B></I><BR>
  196. <%end if%>
  197. <!--
  198. If the query took too long to execute (for example, if too much work
  199. was required to resolve the query), let the user know
  200. -->
  201. <%if Q.CiQueryTimedOut then%>
  202. <P>
  203. <I><B>The query took too long to complete.</B></I><BR>
  204. <%end if%>
  205. <TABLE>
  206. <!--
  207. This is the "previous" button.
  208. This retrieves the previous page of documents for the query.
  209. -->
  210. <%SaveQuery = FALSE%>
  211. <%if CurrentPage > 1 and RS.RecordCount <> -1 then ' could use RS.Supports(adMovePrevious)%>
  212. <td align=left>
  213. <form action="query.asp" method="get">
  214. <INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
  215. <INPUT TYPE="HIDDEN" NAME="so" VALUE="<%=Q.SortBy%>">
  216. <INPUT TYPE="HIDDEN" NAME="co" VALUE="<%=ColSet%>">
  217. <INPUT TYPE="HIDDEN" NAME="ix" VALUE="<%=Q.CiScope%>">
  218. <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" >
  219. <input type="submit" value="Previous <%=RS.PageSize%> documents">
  220. </form>
  221. </td>
  222. <%SaveQuery = TRUE%>
  223. <%end if%>
  224. <!--
  225. This is the "next" button for unsorted queries.
  226. This retrieves the next page of documents for the query.
  227. This is different from the sorted version of "next" because that version
  228. can use the CiRecordsNextPage parameter for the text of the button.
  229. This variable is not available for sequential queries.
  230. -->
  231. <%if Not RS.EOF then%>
  232. <td align=right>
  233. <form action="query.asp" method="get">
  234. <INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
  235. <INPUT TYPE="HIDDEN" NAME="so" VALUE="<%=Q.SortBy%>">
  236. <INPUT TYPE="HIDDEN" NAME="co" VALUE="<%=ColSet%>">
  237. <INPUT TYPE="HIDDEN" NAME="ix" VALUE="<%=Q.CiScope%>">
  238. <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>" >
  239. <% NextString = "Next "
  240. if RS.RecordCount <> -1 then
  241. NextSet = (RS.RecordCount - NextRecordNumber) + 1
  242. if NextSet > RS.PageSize then
  243. NextSet = RS.PageSize
  244. end if
  245. NextString = NextString & NextSet & " documents"
  246. else
  247. NextString = NextString & " page of documents"
  248. end if
  249. %>
  250. <input type="submit" value="<%=NextString%>">
  251. </form>
  252. </td>
  253. <%SaveQuery = TRUE%>
  254. <%end if%>
  255. </TABLE>
  256. <!-- Display the page number -->
  257. Page <%=CurrentPage%>
  258. <%if RS.PageCount <> -1 then
  259. Response.Write " of " & RS.PageCount
  260. end if %>
  261. <%
  262. ' If either of the previous or back buttons were displayed, save the query
  263. ' and the recordset in session variables.
  264. if SaveQuery then
  265. set Session("Query") = Q
  266. set Session("RecordSet") = RS
  267. else
  268. RS.close
  269. Set RS = Nothing
  270. Set Q = Nothing
  271. set Session("Query") = Nothing
  272. set Session("RecordSet") = Nothing
  273. end if
  274. %>
  275. <% end if %>
  276. <p>
  277. <HR WIDTH=80% ALIGN=center SIZE=3>
  278. <p>
  279. <CENTER>
  280. <TABLE WIDTH=600 HEIGHT=50>
  281. <TR>
  282. <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=200>
  283. <font face="Arial, Helvetica" size="1">
  284. <b>
  285. Best experienced with
  286. <br>
  287. <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>
  288. <br>
  289. Click here to start.
  290. </b>
  291. </font>
  292. </TD>
  293. <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=200>
  294. <A HREF="http://www.microsoft.com/default.htm"><IMG WIDTH=175 HEIGHT=45 BORDER=0 SRC="/samples/search/home.gif"></A>
  295. </TD>
  296. <TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=200>
  297. <A HREF="http://www.microsoft.com/Powered/"><IMG BORDER=0 SRC="/samples/search/powrbybo.gif" WIDTH=114 HEIGHT=43></A>
  298. </TD>
  299. </TR>
  300. </TABLE>
  301. </CENTER>
  302. <CENTER><I><FONT SIZE=-1>&copy; 1996 Microsoft Corporation</FONT></I></CENTER>
  303. <BR>
  304. <CENTER>
  305. <I><A HREF="/samples/search/disclaim.htm">Disclaimer</A></I>
  306. </CENTER>
  307. </BODY>
  308. </HTML>