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.

466 lines
15 KiB

  1. <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN" "html.dtd">
  2. <HTML>
  3. <HEAD>
  4. <%
  5. ' ********** INSTRUCTIONS FOR QUICK CUSTOMIZATION **********
  6. '
  7. ' This form is set up for easy customization. It allows you to modify the
  8. ' page logo, the page background, the page title and simple query
  9. ' parameters by modifying a few files and form variables. The procedures
  10. ' to do this are explained below.
  11. '
  12. '
  13. ' *** Modifying the Form Logo:
  14. ' The logo for the form is named is2logo.gif. To change the page logo, simply
  15. ' name your logo is2logo.gif and place in the same directory as this form. If
  16. ' your logo is not a GIF file, or you don't want to copy it, change the following
  17. ' line so that the logo variable contains the URL to your logo.
  18. FormLogo = "is2logo.gif"
  19. '
  20. ' *** Modifying the Form's background pattern.
  21. ' You can use either a background pattern or a background color for your
  22. ' form. If you want to use a background pattern, store the file with the name
  23. ' is2bkgnd.gif in the same directory as this file and remove the remark character
  24. ' the single quote character) from the line below. Then put the remark character on
  25. ' the second line below.
  26. '
  27. ' If you want to use a different background color than white, simply edit the
  28. ' bgcolor line below, replacing white with your color choice.
  29. ' FormBG = "background = " & chr(34) & "is2bkgnd.gif" & chr(34)
  30. FormBG = "bgcolor = " & chr(34) & "#FFFFFF" & chr(34)
  31. ' *** Modifying the Form's Title Text.
  32. ' The Form's title text is set on the following line.
  33. %>
  34. <TITLE>Sample ASP Search Form</TITLE>
  35. <%
  36. '
  37. ' *** Modifying the Form's Search Scope.
  38. '
  39. ' The form will search from the root of your web server's namespace and below
  40. ' (deep from "/" ). To search a subset of your server, for example, maybe just
  41. ' a PressReleases directory, modify the scope variable below to list the virtual path to
  42. ' search. The search will start at the directory you specify and include all sub-
  43. ' directories.
  44. FormScope = "/"
  45. '
  46. ' *** Modifying the Number of Returned Query Results.
  47. '
  48. ' You can set the number of query results returned on a single page
  49. ' using the variable below.
  50. PageSize = 10
  51. '
  52. ' *** Setting the Locale.
  53. '
  54. ' The following line sets the locale used for queries. In most cases, this
  55. ' should match the locale of the server. You can set the locale below.
  56. SiteLocale = "EN-US"
  57. ' ********** END QUICK CUSTOMIZATION SECTIONS ***********
  58. %>
  59. <LINK REL=STYLESHEET HREF="is2style.css" TYPE="text/css">
  60. <META NAME="DESCRIPTION" CONTENT="Sample ASP query form for Indexing Service">
  61. <META NAME="AUTHOR" CONTENT="Indexing Service Team">
  62. <META NAME="KEYWORDS" CONTENT="query, content, hit">
  63. <META NAME="SUBJECT" CONTENT="sample form">
  64. <META NAME="MS.CATEGORY" CONTENT="Internet">
  65. <META NAME="MS.LOCALE" CONTENT="EN-US">
  66. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252">
  67. <%
  68. ' Set Initial Conditions
  69. NewQuery = FALSE
  70. UseSavedQuery = FALSE
  71. SearchString = ""
  72. QueryForm = Request.ServerVariables("PATH_INFO")
  73. ' Did the user press a SUBMIT button to execute the form? If so get the form variables.
  74. if Request.ServerVariables("REQUEST_METHOD") = "POST" then
  75. SearchString = Request.Form("SearchString")
  76. FreeText = Request.Form("FreeText")
  77. ' NOTE: this will be true only if the button is actually pushed.
  78. if Request.Form("Action") = "Go" then
  79. NewQuery = TRUE
  80. RankBase=1000
  81. end if
  82. end if
  83. if Request.ServerVariables("REQUEST_METHOD") = "GET" then
  84. SearchString = Request.QueryString("qu")
  85. FreeText = Request.QueryString("FreeText")
  86. FormScope = Request.QueryString("sc")
  87. RankBase = Request.QueryString("RankBase")
  88. if Request.QueryString("pg") <> "" then
  89. NextPageNumber = Request.QueryString("pg")
  90. NewQuery = FALSE
  91. UseSavedQuery = TRUE
  92. else
  93. NewQuery = SearchString <> ""
  94. end if
  95. end if
  96. %>
  97. </HEAD>
  98. <BODY <%=FormBG%>>
  99. <TABLE>
  100. <TR><TD><A HREF="http://www.microsoft.com/ntserver/search" target="_top"><IMG SRC ="<%=FormLogo%>" VALIGN=MIDDLE ALIGN=LEFT border=0></a></TD></TR>
  101. <TR><TD ALIGN="RIGHT"><H3>Sample ASP Search Form</H3></TD></TR>
  102. </TABLE>
  103. <p>
  104. <FORM ACTION="<%=QueryForm%>" METHOD=POST>
  105. <TABLE WIDTH=500>
  106. <TR>
  107. <TD>Enter your query below:</TD>
  108. </TR>
  109. <TR>
  110. <TD><INPUT TYPE="TEXT" NAME="SearchString" SIZE="65" MAXLENGTH="100" VALUE="<%=SearchString%>"></TD>
  111. <TD><INPUT TYPE="SUBMIT" NAME="Action" VALUE="Go"></TD>
  112. </TR>
  113. <TR>
  114. <TD ALIGN="RIGHT"><A HREF="ixtiphlp.htm">Tips for searching</A></TD>
  115. </TR>
  116. <TR>
  117. </TR>
  118. <TR>
  119. <TD>
  120. <INPUT NAME="FreeText" TYPE=CHECKBOX
  121. <% if FreeText = "on" then
  122. Response.Write(" CHECKED")
  123. end if %>>Use <a href="ixtiphlp.htm#FreeTextQueries">Free-Text Query</a>.
  124. </TD>
  125. </TR>
  126. </TABLE>
  127. </FORM>
  128. <BR>
  129. <%
  130. if NewQuery then
  131. set Session("Query") = nothing
  132. set Session("Recordset") = nothing
  133. NextRecordNumber = 1
  134. ' Remove any leading and ending quotes from SearchString
  135. SrchStrLen = len(SearchString)
  136. if left(SearchString, 1) = chr(34) then
  137. SrchStrLen = SrchStrLen-1
  138. SearchString = right(SearchString, SrchStrLen)
  139. end if
  140. if right(SearchString, 1) = chr(34) then
  141. SrchStrLen = SrchStrLen-1
  142. SearchString = left(SearchString, SrchStrLen)
  143. end if
  144. if FreeText = "on" then
  145. CompSearch = "$contents " & chr(34) & SearchString & chr(34)
  146. else
  147. CompSearch = SearchString
  148. end if
  149. set Q = Server.CreateObject("ixsso.Query")
  150. set util = Server.CreateObject("ixsso.Util")
  151. Q.Query = CompSearch
  152. Q.DefineColumn "breedOrigin (DBTYPE_WSTR) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 breedOrigin"
  153. Q.DefineColumn "breedName (DBTYPE_WSTR) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 breedName"
  154. Q.DefineColumn "breedFirstBred (DBTYPE_UI4) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 breedFirstBred"
  155. Q.DefineColumn "breedWeight (DBTYPE_UI4) = d1b5d3f0-c0b3-11cf-9a92-00a0c908dbf1 breedWeight"
  156. Q.Columns = "DocTitle, vpath, filename, size, write, characterization, rank, breedOrigin"
  157. Q.SortBy = "breedOrigin[d]"
  158. Q.MaxRecords = 300
  159. if FormScope <> "\" then
  160. util.AddScopeToQuery Q, FormScope, "deep"
  161. end if
  162. if SiteLocale<>"" then
  163. Q.LocaleID = util.ISOToLocaleID(SiteLocale)
  164. end if
  165. set RS = Q.CreateRecordSet("nonsequential")
  166. RS.PageSize = PageSize
  167. ActiveQuery = TRUE
  168. elseif UseSavedQuery then
  169. if IsObject( Session("Query") ) And IsObject( Session("RecordSet") ) then
  170. set Q = Session("Query")
  171. set RS = Session("RecordSet")
  172. if RS.RecordCount <> -1 and NextPageNumber <> -1 then
  173. RS.AbsolutePage = NextPageNumber
  174. NextRecordNumber = RS.AbsolutePosition
  175. end if
  176. ActiveQuery = TRUE
  177. else
  178. Response.Write "ERROR - No saved query"
  179. end if
  180. end if
  181. if ActiveQuery then
  182. if not RS.EOF then
  183. %>
  184. <p>
  185. <HR WIDTH=80% ALIGN=center SIZE=3>
  186. <p>
  187. <%
  188. LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
  189. CurrentPage = RS.AbsolutePage
  190. if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
  191. LastRecordOnPage = RS.RecordCount
  192. end if
  193. Response.Write "Documents " & NextRecordNumber & " to " & LastRecordOnPage
  194. if RS.RecordCount <> -1 then
  195. Response.Write " of " & RS.RecordCount
  196. end if
  197. Response.Write " matching the query " & chr(34) & "<I>"
  198. Response.Write SearchString & "</I>" & chr(34) & ".<P>"
  199. %>
  200. <% if Not RS.EOF and NextRecordNumber <= LastRecordOnPage then%>
  201. <table border=0>
  202. <colgroup width=105>
  203. <% end if %>
  204. <% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage
  205. ' This is the detail portion for Title, Abstract, URL, Size, and
  206. ' Modification Date.
  207. ' If there is a title, display it, otherwise display the filename.
  208. %>
  209. <p>
  210. <% ' Graphically indicate rank of document with list of stars (*'s).
  211. if NextRecordNumber = 1 then
  212. RankBase=RS("rank")
  213. end if
  214. if RankBase>1000 then
  215. RankBase=1000
  216. elseif RankBase<1 then
  217. RankBase=1
  218. end if
  219. NormRank = RS("rank")/RankBase
  220. if NormRank > 0.80 then
  221. stars = "rankbtn5.gif"
  222. elseif NormRank > 0.60 then
  223. stars = "rankbtn4.gif"
  224. elseif NormRank > 0.40 then
  225. stars = "rankbtn3.gif"
  226. elseif NormRank >.20 then
  227. stars = "rankbtn2.gif"
  228. else stars = "rankbtn1.gif"
  229. end if
  230. %>
  231. <tr class="RecordTitle">
  232. <td align="right" valign=top class="RecordTitle">
  233. <%= NextRecordNumber%>.
  234. </td>
  235. <td><b class="RecordTitle">
  236. <%if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then%>
  237. <a href="<%=RS("vpath")%>" class="RecordTitle"><%= Server.HTMLEncode( RS("filename") )%></a>
  238. <%else%>
  239. <a href="<%=RS("vpath")%>" class="RecordTitle"><%= Server.HTMLEncode(RS("DocTitle"))%></a>
  240. <%end if%>
  241. </b></td>
  242. </tr>
  243. <tr>
  244. <td valign=top align=left>
  245. <IMG SRC="<%=stars%>">
  246. <br>
  247. <%
  248. ' Construct the URL for hit highlighting
  249. WebHitsQuery = "CiWebHitsFile=" & Server.URLEncode( RS("vpath") )
  250. WebHitsQuery = WebHitsQuery & "&CiRestriction=" & Server.URLEncode( Q.Query )
  251. WebHitsQuery = WebHitsQuery & "&CiBeginHilite=" & Server.URLEncode( "<strong class=Hit>" )
  252. WebHitsQuery = WebHitsQuery & "&CiEndHilite=" & Server.URLEncode( "</strong>" )
  253. WebHitsQuery = WebHitsQuery & "&CiUserParam3=" & QueryForm
  254. ' WebHitsQuery = WebHitsQuery & "&CiLocale=" & Q.LocaleID
  255. %>
  256. <a href="oop/qsumrhit.htw?<%= WebHitsQuery %>"><IMG src="hilight.gif" align=left alt="Highlight matching terms in document using Summary mode."> Summary</a>
  257. <br>
  258. <a href="oop/qfullhit.htw?<%= WebHitsQuery %>&CiHiliteType=Full"><IMG src="hilight.gif" align=left alt="Highlight matching terms in document."> Full</a>
  259. </td>
  260. <td valign=top>
  261. <%if VarType(RS("characterization")) = 8 and RS("characterization") <> "" then%>
  262. <b><i>Abstract: </I></b><%= Server.HTMLEncode(RS("characterization"))%>
  263. <%end if%>
  264. <p>
  265. <%if VarType(RS("breedOrigin")) = 8 and RS("breedOrigin") <> "" then%>
  266. <b><i>Breed Origin: </i></b><%= Server.HTMLEncode(RS("breedOrigin"))%>
  267. <%end if%>
  268. <p>
  269. <i class="RecordStats"><a href="<%=RS("vpath")%>" class="RecordStats" style="color:blue;">http://<%=Request("server_name")%><%=RS("vpath")%></a>
  270. <br><%if RS("size") = "" then%>(size and time unknown)<%else%>size <%=RS("size")%> bytes - <%=RS("write")%> GMT<%end if%></i>
  271. </td>
  272. </tr>
  273. <tr>
  274. </tr>
  275. <%
  276. RS.MoveNext
  277. NextRecordNumber = NextRecordNumber+1
  278. Loop
  279. %>
  280. </table>
  281. <P><BR>
  282. <%
  283. else ' NOT RS.EOF
  284. if NextRecordNumber = 1 then
  285. Response.Write "No documents matched the query<P>"
  286. else
  287. Response.Write "No more documents in the query<P>"
  288. end if
  289. end if ' NOT RS.EOF
  290. if NOT Q.OutOfDate then
  291. ' If the index is current, display the fact %>
  292. <P>
  293. <I><B>The index is up to date.</B></I><BR>
  294. <%end if
  295. if Q.QueryIncomplete then
  296. ' If the query was not executed because it needed to enumerate to
  297. ' resolve the query instead of using the index, but AllowEnumeration
  298. ' was FALSE, let the user know %>
  299. <P>
  300. <I><B>The query is too expensive to complete.</B></I><BR>
  301. <%end if
  302. if Q.QueryTimedOut then
  303. ' If the query took too long to execute (for example, if too much work
  304. ' was required to resolve the query), let the user know %>
  305. <P>
  306. <I><B>The query took too long to complete.</B></I><BR>
  307. <%end if%>
  308. <TABLE>
  309. <%
  310. ' This is the "previous" button.
  311. ' This retrieves the previous page of documents for the query.
  312. %>
  313. <%SaveQuery = FALSE%>
  314. <%if CurrentPage > 1 and RS.RecordCount <> -1 then %>
  315. <td align=left>
  316. <form action="<%=QueryForm%>" method="get">
  317. <INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
  318. <INPUT TYPE="HIDDEN" NAME="FreeText" VALUE="<%=FreeText%>">
  319. <INPUT TYPE="HIDDEN" NAME="sc" VALUE="<%=FormScope%>">
  320. <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" >
  321. <INPUT TYPE="HIDDEN" NAME = "RankBase" VALUE="<%=RankBase%>">
  322. <input type="submit" value="Previous <%=RS.PageSize%> documents">
  323. </form>
  324. </td>
  325. <%SaveQuery = TRUE%>
  326. <%end if%>
  327. <%
  328. ' This is the "next" button for unsorted queries.
  329. ' This retrieves the next page of documents for the query.
  330. if Not RS.EOF then%>
  331. <td align=right>
  332. <form action="<%=QueryForm%>" method="get">
  333. <INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
  334. <INPUT TYPE="HIDDEN" NAME="FreeText" VALUE="<%=FreeText%>">
  335. <INPUT TYPE="HIDDEN" NAME="sc" VALUE="<%=FormScope%>">
  336. <INPUT TYPE="HIDDEN" NAME = "RankBase" VALUE="<%=RankBase%>">
  337. <INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>">
  338. <% NextString = "Next "
  339. if RS.RecordCount <> -1 then
  340. NextSet = (RS.RecordCount - NextRecordNumber) + 1
  341. if NextSet > RS.PageSize then
  342. NextSet = RS.PageSize
  343. end if
  344. NextString = NextString & NextSet & " documents"
  345. else
  346. NextString = NextString & " page of documents"
  347. end if
  348. %>
  349. <input type="submit" value="<%=NextString%>">
  350. </form>
  351. </td>
  352. <%SaveQuery = TRUE%>
  353. <%end if%>
  354. </TABLE>
  355. <% ' Display the page number %>
  356. Page <%=CurrentPage%>
  357. <%if RS.PageCount <> -1 then
  358. Response.Write " of " & RS.PageCount
  359. end if %>
  360. <%
  361. ' If either of the previous or back buttons were displayed, save the query
  362. ' and the recordset in session variables.
  363. if SaveQuery then
  364. set Session("Query") = Q
  365. set Session("RecordSet") = RS
  366. else
  367. RS.close
  368. Set RS = Nothing
  369. Set Q = Nothing
  370. set Session("Query") = Nothing
  371. set Session("RecordSet") = Nothing
  372. end if
  373. %>
  374. <% end if %>
  375. <!--#include file ="is2foot.inc"-->
  376. </BODY>
  377. </HTML>