<% '------------------------------------------------------------------------------------------ ' Page Name: Search.asp ' Author: Martin Stiby ' Synopsis: Site document search. '------------------------------------------------------------------------------------------ ' Date | Author | Version | Reason and Description '------------------------------------------------------------------------------------------ ' 22Feb00 | Martin Stiby | 1.0 | Creation ' 29Feb00 | Brian Southby | 1.1 | Cursor now locates to the search form on load '------------------------------------------------------------------------------------------ 'If the client requests a link, redirect them to that page. if (Request("jump.x") <> "") then Response.Redirect(Request("Index")) end if %> <% ' Customize parameters FormScope = "/" PageSize = 10 SiteLocale = "EN-US" Catalog = "Crossroads" ' Query parameters NewQuery = FALSE UseSavedQuery = FALSE SaveQuery = FALSE AndSaveQuery = FALSE QueryColumns = "DocTitle, vpath, filename, size, write, characterization" ' Here comes the tricky bit. We don't want any FrontPage *vti* directories to be included in the ' search results, or other sensitive files, so "not #VPath |(*vti*|)" ' is added to the query solves this. ' Next, we only want HTM, SHTM or SHTML files to be returned, ' so "and #filename *.|(htm|,shtm|,shtml|)" solves this. ' The "#Path |(*crossroadshospice*|)" ensures that only files with that string in there file path are considered. QueryParameterString = " and not #VPath |(*vti*|) and #Path |(*crossroadshospice.bc.ca*|) and #filename *.|(htm|,shtm|,shtml|)" SearchString = "" QueryForm = Request.ServerVariables("PATH_INFO") ' Three ways of coming in - first display of page, hit "go", or hit prev/next if Request("SearchString").Count <> 0 then ' Not first time in page if Request("pg").Count <> 0 then ' Coming in using prev/next SearchString = Request("SearchString") if Request("pg") <> "" then NextPageNumber = Request("pg") NewQuery = FALSE UseSavedQuery = TRUE else NewQuery = SearchString <> "" end if else ' Coming in via Go! or ENTER key SearchString = Request("SearchString") NewQuery = TRUE end if end if %> Search Search
Crossroads Hospice Society Contact Information Help/FAQ Search Facilities Home
About Us
People Involved
Programs
Volunteering
Donations
Sponsors
Events Calendar
Resources

Search Facilities


For quick searches on word(s) or exact phrases, enter in the following description box.   Click "Start Search" button to search for results.  A list of results will be displayed.  To get to the specific page, click on the link.  If you like to make changes to what you've entered, click "Reset" button.

 

Search For: ">
Examples: Volunteer, Events, Programs
<% if NewQuery then set Session("Query") = nothing set Session("Recordset") = nothing NextRecordNumber = 1 ' Remove any leading and ending quotes from SearchString if not (SearchString = "") then 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 CompSearch = SearchString set Q = Server.CreateObject("ixsso.Query") set util = Server.CreateObject("ixsso.Util") ' Adding "@all" to query so that the meta keywords tag will get searched. Q.Query = "@all (" & CompSearch & ") " & QueryParameterString Q.SortBy = "rank[d]" Q.Columns = QueryColumns Q.MaxRecords = 100 Q.AllowEnumeration = True Q.Catalog = Catalog 'Now set up a search string, that searches for the words in the body of the text, not 'just the string of text (put AND between the words in the string). 'The logic: look for an occurence of a space, put everything since the last space 'into the TempString, then concatenate TempString and " and " onto the end of the 'search string (AndSearch). Continue this process until there are no more spaces 'or the end of the string is found. stringLen = 1 'get the position of the first space in the string MyPos = Instr(1, SearchString, chr(32), 0) do while (MyPos <> 0 or MyPos <> Null) 'get the next word in the string TempString = Mid(SearchString, stringLen, MyPos-stringLen) 'get the next word in the string (ahead by 2 - this is to check for booleans), but 'make sure that you have not hit the end of the string if not (Instr(MyPos + 1, SearchString, chr(32), 0) = 0) then CompString = Mid(SearchString, MyPos + 1, Instr(MyPos + 1, SearchString, chr(32), 0)-MyPos - 1) end if 'check for boolean values If StrComp(CompString, "and", 1)<>0 and StrComp(CompString, "not", 1)<>0 and StrComp(CompString, "or", 1)<>0 and StrComp(CompString, "near", 1)<>0 and StrComp(TempString, "and", 1)<>0 and StrComp(TempString, "not", 1)<>0 and StrComp(TempString, "or", 1)<>0 and StrComp(TempString, "near", 1)<>0 then AndSearch = AndSearch & TempString & " and " else AndSearch = AndSearch & TempString & " " end if stringLen = MyPos + 1 MyPos = Instr(stringLen, SearchString, chr(32), 0) TempString = "" Loop stringLen = stringLen TempString = Mid(SearchString, stringLen, len(SearchString)) AndSearch = AndSearch & TempString set Q_And = Server.CreateObject("ixsso.Query") Q_And.Query = AndSearch 'Do a query on the words of the string using AND Q_And.Query = "@all (" & AndSearch & ") " & QueryParameterString Q_And.SortBy = "rank[d]" Q_And.Columns = QueryColumns Q_And.MaxRecords = 100 Q_And.AllowEnumeration = True 'Now set up a search string, that searches for any of the words in the body of the text, 'not just the string of text (put OR between the words in the string). 'The logic: look for an occurence of a space, put everything since the last space 'into the TempString, then concatenate TempString and " or " onto the end of the 'search string (OrSearch). Continue this process until there are no more spaces 'or the end of the string is found. stringLen = 1 'get the position of the first space in the string MyPos = Instr(1, SearchString, chr(32), 0) do while (MyPos <> 0 or MyPos <> Null) 'get the next word in the string TempString = Mid(SearchString, stringLen, MyPos-stringLen) 'get the next word in the string (ahead by 2 - this is to check for booleans), but 'make sure that you have not hit the end of the string if not (Instr(MyPos + 1, SearchString, chr(32), 0) = 0) then CompString = Mid(SearchString, MyPos + 1, Instr(MyPos + 1, SearchString, chr(32), 0)-MyPos - 1) else CompString = " " end if 'check for boolean values If StrComp(CompString, "and", 1)<>0 and StrComp(CompString, "not", 1)<>0 and StrComp(CompString, "or", 1)<>0 and StrComp(CompString, "near", 1)<>0 and StrComp(TempString, "and", 1)<>0 and StrComp(TempString, "not", 1)<>0 and StrComp(TempString, "or", 1)<>0 and StrComp(TempString, "near", 1)<>0 then OrSearch = OrSearch & TempString & " or " else OrSearch = OrSearch & TempString & " " end if stringLen = MyPos + 1 MyPos = Instr(stringLen, SearchString, chr(32), 0) TempString = "" Loop TempString = Mid(SearchString, stringLen, len(SearchString)) OrSearch = OrSearch & TempString set Q_Or = Server.CreateObject("ixsso.Query") Q_Or.Query = OrSearch 'Do a query on the words of the string using AND Q_Or.Query = "@all (" & OrSearch & ") " & QueryParameterString Q_Or.SortBy = "rank[d]" Q_Or.Columns = QueryColumns Q_Or.MaxRecords = 100 Q_Or.AllowEnumeration = True if FormScope <> "/" then util.AddScopeToQuery Q, FormScope, "deep" end if if SiteLocale<>"" then Q.LocaleID = util.ISOToLocaleID(SiteLocale) end if 'if the user entered garbage this next line will catch it, this line also checks to determine 'which search to use (i.e. Regular, And or Or) Response.Write vbcrlf & "" & vbcrlf On Error Resume Next ' Defer error trapping. set RS = Q.CreateRecordSet("nonsequential") if RS.EOF then Response.Write vbcrlf & "" & vbcrlf On Error Resume Next ' Defer error trapping. set RS = Q_And.CreateRecordSet("nonsequential") if RS.EOF then Response.Write vbcrlf & "" & vbcrlf On Error Resume Next ' Defer error trapping. set RS = Q_Or.CreateRecordSet("nonsequential") end if end if if IsObject(RS) then ' RS is not an object when index server had a problem with the search criteria RS.PageSize = PageSize ActiveQuery = TRUE else ' The user put in a query we couldn't handle Response.Write "No documents matched the query." %>

New search <% end if else Response.Write "
" & "No search query entered, please type in your search and click on the search button" & "
" end if 'not searchString = "" 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 "Search query has expired. Please re-enter your search." end if end if if ActiveQuery then if not RS.EOF then Response.Write "

" 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) & ".

" Response.Write "

" 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. %>

<%= NextRecordNumber%>. <%if VarType(RS("DocTitle")) = 1 or RS("DocTitle") = "" then%> "><%= Server.HTMLEncode( RS("filename") )%> <%else%> "><%= Server.HTMLEncode(RS("DocTitle"))%> <%end if%> <%if false and VarType(RS("characterization")) = 8 and RS("characterization") <> "" then%> Abstract: <%= Server.HTMLEncode(RS("characterization"))%>
<%end if%> ">http://<%=Request("server_name")%><%=RS("vpath")%> - <%if RS("size") = "" then%>(size and time unknown)<%else%>size <%=RS("size")%>bytes - <%=RS("write")%> GMT<%end if%> <%if SearchString <> "" then%>

<%end if%><% RS.MoveNext NextRecordNumber = NextRecordNumber+1 Loop Response.Write "


" else ' NOT RS.EOF if NextRecordNumber = 1 then Response.Write "No documents matched the query

" else Response.Write "No more documents in the query

" end if %>
New search <% end if ' NOT RS.EOF 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 %>

The query took too long to complete.
<% 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%>

<% 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 %>

<% ' Display the page number if CurrentPage <> "" then Response.Write "Page " & CurrentPage if RS.PageCount <> -1 then Response.Write " of " & RS.PageCount end if ' Show how to get back to the original search page %>


New search <% 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 %>

Serving the communities of: Anmore, Belcarra, Coquitlam, New Westminster, Port Coquitlam and Port Moody
Developed with the assistance of Ionysys Technology Corporation