home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
iis4_07.cab
/
AdvSearch.asp
< prev
next >
Wrap
Text File
|
1997-11-01
|
18KB
|
561 lines
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
</SCRIPT>
<TITLE>Advanced Site Search</TITLE>
<META NAME="DESCRIPTION" CONTENT="ExAir's Advanced Sample search query form">
<META NAME="KEYWORDS" CONTENT="search, query, content, hit">
<META NAME="GENERATOR" CONTENT="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso8859-1">
<!--#include file=..\libGlobalFuncs.inc-->
<%
If Not IsIndexServerInstalled() Then
Response.Redirect("NoIndexServer.asp")
End If
%>
<%
DebugFlag = FALSE
NewQuery = FALSE
UseSavedQuery = FALSE
SearchString = ""
' If request_method is a post then we have posted back to ourselves
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
SearchString = Request.Form("SearchString")
DocAuthorRestriction = Request.Form("DocAuthorRestriction")
FSRest = Request.Form("FSRest")
FSRestVal = Request.Form("FSRestVal")
FSRestOther = Request.Form("FSRestOther")
FMMod = Request.Form("FMMod")
FMModDate = Request.Form("FMModDate")
SortBy = Request.Form("SortBy")
Colset = Request.Form("ColChoice")
Scope = Request.Form("Scope")
' NOTE: this will be true only if the button is actually pushed.
if Request.Form("Action") = "Search" then
NewQuery = TRUE
end if
end if
%>
</HEAD>
<BODY BGCOLOR=#FFFFFF TOPMARGIN=0 LEFTMARGIN=0 ALINK=#23238E VLINK=#228B22 LINK=#23238E>
<BASEFONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2>
<!--Change link color on mouseover
Only if running Internet Explorer 4.0 or later -->
<!--#include file=../libHighlight.inc-->
<!--COLOR BANNER_START-->
<CENTER>
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
</TD>
</TR>
</TABLE>
</CENTER>
<!--COLOR BANNER_END-->
<!--BEGIN TABLE CONTAINING LOGO AND NAVIGATIONAL LINKS -->
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD VALIGN=TOP WIDTH=415>
<A HREF="<%=HomePage("..")%>"><IMG SRC="../images/logo_sm.gif" WIDTH=200 HEIGHT=100 ALT="Return to Exploration Air Homepage" BORDER=0></A>
<BR>
<A HREF="<%=HomePage("..")%>"><IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5 ALT="Return to Exploration Air Homepage" BORDER=0></A>
<FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2"><STRONG><A HREF="<%=HomePage("..")%>">EXPLORATION AIR HOMEPAGE</A></STRONG></FONT>
</TD>
<TD VALIGN=MIDDLE WIDTH=200><FONT FACE="VERDANA, ARIAL, HELVETICA" COLOR="#0000FF" SIZE=5>Advanced Search Page</FONT>
</TD>
<TD ALIGN=RIGHT VALIGN=MIDDLE>
<A HREF="../HowItWorks/HIWIndexServer.asp"><IMG SRC="../images/btssmall.gif" WIDTH="115" HEIGHT="52" ALT="Click here to learn how this page works" BORDER=0></A>
</TD>
</TR>
<TR>
<TD VALIGN=TOP WIDTH=415 HEIGHT=15>
<A HREF="Search.Asp"><IMG SRC="../images/barrowy.gif" HEIGHT=8 WIDTH=8 HSPACE=5 ALT="Return to Simple Search Page" BORDER=0></A>
<FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE=2> <STRONG><A HREF="Search.Asp">SIMPLE SEARCH PAGE</A></STRONG></FONT>
</TD>
</TR>
</TABLE>
<!--END TABLE CONTAINING LOGO AND NAVIGATIONAL LINKS -->
<BR>
<SCRIPT LANGUAGE=JavaScript>
function SetAll()
{
document.QForm.SearchString.value = "<%=SearchString%>";
<%select case FSRest%>
<%case " > "%>
document.QForm.FSRest.selectedIndex = 1;
<%case else%>
document.QForm.FSRest.selectedIndex = 0;
<%end select%>
<%select case FSRestVal%>
<%case "any"%>
document.QForm.FSRestVal.selectedIndex = 0;
<%case "100"%>
document.QForm.FSRestVal.selectedIndex = 1;
<%case "1024"%>
document.QForm.FSRestVal.selectedIndex = 2;
<%case "10240"%>
document.QForm.FSRestVal.selectedIndex = 3;
<%case "102400"%>
document.QForm.FSRestVal.selectedIndex = 4;
<%case "1048576"%>
document.QForm.FSRestVal.selectedIndex = 5;
<%case "10485760"%>
document.QForm.FSRestVal.selectedIndex = 6;
<%case "104857600"%>
document.QForm.FSRestVal.selectedIndex = 7;
<%case "other"%>
document.QForm.FSRestVal.selectedIndex = 8;
<%case else%>
document.QForm.FSRestVal.selectedIndex = 0;
<%end select%>
document.QForm.FSRestOther.value = "<%=FSRestOther%>";
<%select case FMMod%>
<%case "any"%>
document.QForm.FMMod.selectedIndex = 0;
<%case "-10n"%>
document.QForm.FMMod.selectedIndex = 1;
<%case "-1h"%>
document.QForm.FMMod.selectedIndex = 2;
<%case "-1d"%>
document.QForm.FMMod.selectedIndex = 3;
<%case "-1w"%>
document.QForm.FMMod.selectedIndex = 4;
<%case "-1m"%>
document.QForm.FMMod.selectedIndex = 5;
<%case "-1y"%>
document.QForm.FMMod.selectedIndex = 6;
<%case "since"%>
document.QForm.FMMod.selectedIndex = 7;
<%case else%>
document.QForm.FMMod.selectedIndex = 0;
<%end select%>
document.QForm.FMModDate.value = "<%=FMModDate%>";
document.QForm.DocAuthorRestriction.value = "<%=DocAuthorRestriction%>";
}
</SCRIPT>
<TABLE CELLPADDING=10>
<TR>
<TD COLSPAN=2>
<FORM NAME="QForm" ACTION="AdvSearch.Asp" METHOD=POST>
<IMG SRC="../images/search.jpg" WIDTH=217 HEIGHT=169 ALT="Search the site" BORDER=0></A></TD>
<TD>
Please fill out the form below to create your complex search query:</TD>
</TR>
<TR>
<TD WIDTH=60> </TD>
<TD ALIGN=RIGHT>
<FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2">
Words to search for:
</FONT>
</TD>
<TD>
<INPUT TYPE="TEXT" NAME="SearchString" SIZE="40" MAXLENGTH="100" VALUE="">
<INPUT TYPE="SUBMIT" NAME="Action" VALUE="Search">
<INPUT TYPE="RESET" NAME="Clear" VALUE="Clear">
</TD>
</TR>
<TR>
<TD WIDTH=60> </TD>
<TD ALIGN=RIGHT>
<FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2">
File Size is:
</FONT>
</TD>
<TD>
<SELECT NAME="FSRest">
<OPTION VALUE=" < " SELECTED>Less Than
<OPTION VALUE=" > " >Greater Than
</SELECT>
<SELECT NAME="FSRestVal">
<OPTION VALUE="any" SELECTED>any size
<OPTION VALUE="100" >100 bytes
<OPTION VALUE="1024" >1K bytes
<OPTION VALUE="10240" >10K bytes
<OPTION VALUE="102400" >100K bytes
<OPTION VALUE="1048576" >1M byte
<OPTION VALUE="10485760" >10M bytes
<OPTION VALUE="104857600" >100M bytes
<OPTION VALUE="other" >Other
</SELECT>
<INPUT TYPE="TEXT" NAME="FSRestOther" SIZE="14" MAXLENGTH="9" VALUE="">
</TD>
</TR>
<TR>
<TD WIDTH=60> </TD>
<TD ALIGN=RIGHT>
<FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2">
Modified:
</FONT>
</TD>
<TD>
<SELECT NAME="FMMod">
<OPTION VALUE="any" SELECTED >at any time.
<OPTION VALUE="-10n">in the last 10 minutes.
<OPTION VALUE="-1h">in the last hour.
<OPTION VALUE="-1d">in the last day.
<OPTION VALUE="-1w">in the last week.
<OPTION VALUE="-1m">in the last month.
<OPTION VALUE="-1y">in the last year.
<OPTION VALUE="since">since GMT (yy/mm/dd)
</SELECT>
<INPUT TYPE="TEXT" NAME="FMModDate" SIZE="20" MAXLENGTH="9" VALUE="">
</TD>
</TR>
<TR>
<TD WIDTH=60> </TD>
<TD ALIGN=RIGHT>
<FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="2">
Document Author:
</FONT>
</TD>
<TD>
<INPUT TYPE="TEXT" NAME="DocAuthorRestriction" SIZE="40" MAXLENGTH="100" VALUE="">
</TD>
</TR>
<INPUT TYPE="HIDDEN" NAME="SortBy" VALUE="rank[d]">
<INPUT TYPE="HIDDEN" NAME="ColChoice" VALUE="1">
<INPUT TYPE="HIDDEN" NAME="Scope" VALUE="/iissamples/ExAir">
</TABLE>
</FORM>
<BR>
<%if DebugFlag then%>
<PRE>
SearchString = <%=SearchString%>
DocAuthorRestriction = <%=DocAuthorRestriction%>
FSRest = <%=FSRest%>
FSRestVal = <%=FSRestVal%>
FSRestOther = <%=FSRestOther%>
FMMod = <%=FMMod%>
FMModDate = <%=FMModDate%>
SortBy = <%=SortBy%>
Colset = <%=Colset%>
Scope = <%=Scope%>
NewQuery = <%=CStr(NewQuery)%>
UseSavedQuery = <%=CStr(UseSavedQuery)%>
</PRE>
<%end if%>
<%
if NewQuery then
set Session("Query") = nothing
set Session("Recordset") = nothing
NextRecordNumber = 1
set Q = Server.CreateObject("ixsso.Query")
Composer = ""
TheQuery = ""
if SearchString <> "" then
if Left( SearchSting, 1 ) <> "@" AND Left( SearchString, 1 ) <> "#" AND Left( SearchString, 1 ) <> "$" then
TheQuery = "@Contents " + SearchString
else
TheQuery = SearchString
end if
Composer = " & "
end if
if FSRestVal <> "any" then
if FSRestVal <> "other" then
TheQuery = "(@Size " + FSRest + FSRestVal + ") " + Composer + TheQuery
else
TheQuery = "(@Size " + FSRest + FSRestOther + ") " + Composer + TheQuery
end if
Composer = " & "
end if
if DocAuthorRestriction <> "" then
TheQuery = "(@DocAuthor " + DocAuthorRestriction + ") " + Composer + TheQuery
Composer = " & "
end if
if FMMod <> "" AND FMMod <> "any" then
if FMMod <> "since" then
TheQuery = "(@Write > " + FMMod + ") " + Composer + TheQuery
else
TheQuery = "(@Write > " + FMModDate + ") " + Composer + TheQuery
end if
end if
%> <%if DebugFlag then%> TheQuery = <%=TheQuery%> <%end if%> <%
Q.Query = TheQuery
Q.SortBy = SortBy
if Scope <> "/" then
set Util = Server.CreateObject("ixsso.Util")
Util.AddScopeToQuery Q, Scope, "DEEP"
set Util = nothing
end if
if ColSet = 1 then
Q.Columns = "DocTitle, vpath, path, filename, size, write, characterization"
RecordsPerPage = 10
elseif ColSet = 2 then
Q.Columns = "vpath, path"
RecordsPerPage = 200
elseif ColSet = 3 then
Q.Columns = "filename, vpath, size, write"
RecordsPerPage = 25
end if
set RS = Q.CreateRecordSet("nonsequential")
RS.PageSize = RecordsPerPage
ActiveQuery = TRUE
elseif UseSavedQuery then
if IsObject( Session("Query") ) And IsObject( Session("RecordSet") ) then
set Q = Session("Query")
set RS = Session("RecordSet")
if RS.RecordCount <> -1 and NextPageNumber <> -1 then
RS.AbsolutePage = NextPageNumber
NextRecordNumber = RS.AbsolutePosition
end if
ActiveQuery = TRUE
else
Response.Write "ERROR - No saved query"
end if
end if
if ActiveQuery then
if not RS.EOF then
%>
<CENTER>
<P>
<HR WIDTH=500>
<P>
</CENTER>
<%
LastRecordOnPage = NextRecordNumber + RS.PageSize - 1
CurrentPage = RS.AbsolutePage
if RS.RecordCount <> -1 AND RS.RecordCount < LastRecordOnPage then
LastRecordOnPage = RS.RecordCount
end if
Response.Write "Documents " & NextRecordNumber & " to " & LastRecordOnPage
if RS.RecordCount <> -1 then
Response.Write " of " & RS.RecordCount
end if
if SearchString <> "" then
Response.Write " matching the query " & chr(34) & "<I>"
Response.Write SearchString & "</I>" & chr(34) & ".<P>"
end if
%>
</PRE>
<!-- BEGIN column header -->
<% if ColSet = 1 then%>
<!--#include file = "qryhead1.inc"-->
<% elseif ColSet = 2 then%>
<!--#include file = "qryhead2.inc"-->
<% elseif ColSet = 3 then%>
<!--#include file = "qryhead3.inc"-->
<% end if%>
<%if DebugFlag then%>
<PRE>
RS.EOF = <%=CStr(RS.EOF)%>
NextRecordNumber = <%=NextRecordNumber%>
LastRecordOnPage = <%=LastRecordOnPage%>
</PRE>
<%end if%>
<!-- BEGIN first row of query results table -->
<% Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage %>
<% if ColSet = 1 then%>
<!--#include file="qrybody1.inc"-->
<% elseif ColSet = 2 then%>
<!--#include file="qrybody2.inc"-->
<% elseif ColSet = 3 then%>
<!--#include file="qrybody3.inc"-->
<% end if%>
<%
RS.MoveNext
NextRecordNumber = NextRecordNumber+1
Loop
%>
<% if ColSet = 1 then%>
<!--#include file="qrytail1.inc"-->
<% elseif ColSet = 2 then%>
<!--#include file="qrytail2.inc"-->
<% elseif ColSet = 3 then%>
<!--#include file="qrytail3.inc"-->
<% end if%>
<P><BR>
<%
else ' NOT RS.EOF
if NextRecordNumber = 1 then
Response.Write "No documents matched the query<P>"
else
Response.Write "No more documents in the query<P>"
end if
end if ' NOT RS.EOF
%>
<!-- If the index is out of date, display the fact -->
<%if Q.OutOfDate then%>
<P>
<I><B>The index is out of date.</B></I><BR>
<%end if%>
<!--
If the query was not executed because it needed to enumerate to
resolve the query instead of using the index, but AllowEnumeration
was FALSE, let the user know
-->
<%if Q.QueryIncomplete then%>
<P>
<I><B>The query is too expensive to complete.</B></I><BR>
<%end if%>
<!--
If the query took too long to execute (for example, if too much work
was required to resolve the query), let the user know
-->
<%if Q.QueryTimedOut then%>
<P>
<I><B>The query took too long to complete.</B></I><BR>
<%end if%>
<TABLE>
<!--
This is the "previous" button.
This retrieves the previous page of documents for the query.
-->
<%SaveQuery = FALSE%>
<%if CurrentPage > 1 and RS.RecordCount <> -1 then ' BUGBUG - use RS.Supports(adMovePrevious)%>
<td align=left>
<form action="query.asp" method="get">
<INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
<INPUT TYPE="HIDDEN" NAME="so" VALUE="<%=Q.SortBy%>">
<INPUT TYPE="HIDDEN" NAME="co" VALUE="<%=ColSet%>">
<INPUT TYPE="HIDDEN" NAME="sc" VALUE="<%=Q.CiScope%>">
<INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage-1%>" >
<input type="submit" value="Previous <%=RS.PageSize%> documents">
</form>
</TD>
<%SaveQuery = TRUE%>
<%end if%>
<!--
This is the "next" button for unsorted queries.
This retrieves the next page of documents for the query.
This is different from the sorted version of "next" because that version
can use the CiRecordsNextPage parameter for the text of the button.
This variable is not available for sequential queries.
-->
<%if Not RS.EOF then%>
<TD ALIGN=RIGHT>
<form action="query.asp" method="get">
<INPUT TYPE="HIDDEN" NAME="qu" VALUE="<%=SearchString%>">
<INPUT TYPE="HIDDEN" NAME="so" VALUE="<%=Q.SortBy%>">
<INPUT TYPE="HIDDEN" NAME="co" VALUE="<%=ColSet%>">
<INPUT TYPE="HIDDEN" NAME="sc" VALUE="<%=Q.CiScope%>">
<INPUT TYPE="HIDDEN" name="pg" VALUE="<%=CurrentPage+1%>" >
<% NextString = "Next "
if RS.RecordCount <> -1 then
NextSet = (RS.RecordCount - NextRecordNumber) + 1
if NextSet > RS.PageSize then
NextSet = RS.PageSize
end if
NextString = NextString & NextSet & " documents"
else
NextString = NextString & " page of documents"
end if
%>
<input type="submit" value="<%=NextString%>">
</FORM>
</TD>
<%SaveQuery = TRUE%>
<%end if%>
</TABLE>
<!-- Display the page number -->
Page <%=CurrentPage%>
<%if RS.PageCount <> -1 then
Response.Write " of " & RS.PageCount
end if %>
<%
' If either of the previous or back buttons were displayed, save the query
' and the recordset in session variables.
if SaveQuery then
set Session("Query") = Q
set Session("RecordSet") = RS
else
RS.close
Set RS = Nothing
Set Q = Nothing
set Session("Query") = Nothing
set Session("RecordSet") = Nothing
end if
%>
<% end if %>
<P>
<CENTER>
<FONT FACE="VERDANA, ARIAL, HELVETICA" SIZE="1"><A HREF="../legal.htm">©1997 Microsoft Corporation. All rights reserved. Terms of Use.</A></FONT>
</CENTER>
<P>
<!--BEGIN COLOR BANNER-->
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR>
<TD BGCOLOR="#C71585" WIDTH=100% HEIGHT=20>
</TD>
</TR>
</TABLE>
<!--END COLOR BANNER-->
</BODY>
</HTML>