|
|
 |
|
<%
Dim ActiveQuery
Dim NextRecordNumber
Dim SrchStrLen
Dim CompSearch
Dim Q
Dim util
Dim RS
Dim LastRecordOnPage
Dim CurrentPage
Dim NormRank
Dim stars
Dim WebHitsQuery
Dim SaveQuery
Dim NextString
Dim NextSet
Dim NextPageNumber
If NewQuery Then
'If SrchStrLen = "" Then
' ActiveQuery = FALSE
'End If
Set Session("Query") = Nothing
Set Session("Recordset") = Nothing
NextRecordNumber = 1
' Remove any leading and ending quotes from SearchString
SrchStrLen = len(SearchString)
If left(SearchString, 1) = chr(34) Then
SrchStrLen = SrchStrLen-1
SearchString = right(SearchString, SrchStrLen)
End If
If right(SearchString, 1) = chr(34) Then
SrchStrLen = SrchStrLen-1
SearchString = left(SearchString, SrchStrLen)
End If
If FreeText = "on" Then
CompSearch = "$contents " & chr(34) & SearchString & chr(34)
Else
CompSearch = SearchString
End If
Set Q = Server.CreateObject("ixsso.Query")
Set util = Server.CreateObject("ixsso.Util")
'Q.Query = CompSearch
Q.Query = "! #vpath *\_vti_* &! #vpath *\stats\* &! #vpath *\search\* & @contents " & CompSearch
Q.SortBy = "rank[d]"
Q.Columns = "DocTitle, vpath, filename, size, write, characterization, rank"
Q.Catalog = "ACT"
Q.MaxRecords = 300
' Enable query to search in specific folders.
Dim FolderQuery
FolderQuery = Request.Form("folder")
FolderQuery = Lcase(FolderQuery)
'If UCASE(FolderQuery) = "ALL" Then
util.AddScopeToQuery Q, "/", "deep"
'Else
' util.AddScopeToQuery Q, "/ovum/" & FolderQuery & "/", "shallow"
'End If
'If FormScope <> "/" Then
'util.AddScopeToQuery Q, FormScope, "deep"
'End If
If SiteLocale<>"" Then
Q.LocaleID = util.ISOToLocaleID(SiteLocale)
End If
Set RS = Q.CreateRecordSet("nonsequential")
RS.PageSize = PageSize
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
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
Response.Write " matching the query " & chr(34) & ""
Response.Write SearchString & "" & chr(34) & "."
If Not RS.EOF and NextRecordNumber <= LastRecordOnPage Then
%>
<%
End If
Do While Not RS.EOF and NextRecordNumber <= LastRecordOnPage
' This is the detail portion for Title, Abstract, URL, Size, and
' Modification Date.
' If there is a title, display it, otherwise display the filename.
%>
<% ' Graphically indicate rank of document with list of stars (*'s).
If NextRecordNumber = 1 Then
RankBase=RS("rank")
End If
If RankBase>1000 Then
RankBase=1000
Elseif RankBase<1 Then
RankBase=1
End If
NormRank = RS("rank")/RankBase
If NormRank > 0.80 Then
stars = "../images/fivestar.gif"
Elseif NormRank > 0.60 Then
stars = "../images/fourstar.gif"
Elseif NormRank > 0.40 Then
stars = "../images/threestar.gif"
Elseif NormRank > 0.20 Then
stars = "../images/twostar.gif"
Else stars = "../images/onestar.gif"
End If
%>
|
<%= NextRecordNumber%>.
|
<%If VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" Then%>
" class="RecordTitle"><%= Server.HTMLEncode( RS("filename") )%>
<%Else%>
" class="RecordTitle"><%= Server.HTMLEncode(RS("DocTitle"))%>
<%End If%>
|
<%
'Construct the URL for hit highlighting
WebHitsQuery = "CiWebHitsFile=" & Server.URLEncode( RS("vpath") )
WebHitsQuery = WebHitsQuery & "&CiRestriction=" & Server.URLEncode( Q.Query )
WebHitsQuery = WebHitsQuery & "&CiBeginHilite=" & Server.URLEncode( "" )
WebHitsQuery = WebHitsQuery & "&CiEndHilite=" & Server.URLEncode( "" )
WebHitsQuery = WebHitsQuery & "&CiUserParam3=" & QueryForm
'WebHitsQuery = WebHitsQuery & "&CiLocale=" & Q.LocaleID
%>
|
<%If VarType(RS("characterization")) = 8 and RS("characterization") <> "" Then%>
Abstract: <%= Server.HTMLEncode(RS("characterization"))%>
<%End If%>
" class="RecordStats" style="color:blue;">http://<%=Request("server_name")%><%=RS("vpath")%>
<%If RS("size") = "" Then%>(size and time unknown)<%Else%>size <%=RS("size")%> bytes - <%=RS("write")%> GMT<%End If%>
|
<%
RS.MoveNext
NextRecordNumber = NextRecordNumber+1
Loop
%>
<%
Else ' NOT RS.EOF
If NextRecordNumber = 1 Then
'Response.Write "NextRecordNumber [" & NextRecordNumber & "] "
Response.Write "No documents matched the query
"
Else
'Response.Write "NextRecordNumber [" & NextRecordNumber & "] "
Response.Write "No more documents in the query "
End If
End If ' NOT RS.EOF
If NOT Q.OutOfDate Then
' If the index is current, display the fact %>
The index is up to date.
<%
End If
If Q.QueryIncomplete Then
' 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
%>
The query is too expensive to complete.
<%
End If
If Q.QueryTimedOut Then
' If the query took too long to execute (for example, if too much work
' was required to resolve the query), let the user know
%>
<%
End If
%>
<%
' 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 %>
|
|
<%
SaveQuery = TRUE
End If
' This is the "next" button for unsorted queries.
' This retrieves the next page of documents for the query.
If Not RS.EOF Then
%>
|
<%SaveQuery = TRUE
End If
%>
<% ' 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
%>
|