Portal do Espírito

Mapa do Site | Pesquisa no Site | Categorias
Página principal » Pesquisa no Site
<% strQuery = Request("q") If strQuery = "" Then %>

Nada a pesquisar

<% Else lcErrorMsg = "" 'Grava a query para estatística futura On Error Resume Next Set objQuery = Server.CreateObject("ADODB.Connection") objQuery.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=D:\web\brnt3sp269\databases\pesquisa.mdb;Uid=;Pwd=" Set objQueryRs = Server.CreateObject("ADODB.Recordset") objQueryRs.Open "select * from pesquisa", objQuery, 1, 2 objQueryRs.AddNew objQueryRs.Fields("Data").Value = Now objQueryRs.Fields("Query").Value = strQuery objQueryRs.Update objQueryRs.Close objQuery.Close set objQueryRs = nothing set objQuery = nothing Set rs = RunQuery(strQuery, strVirtual) if TypeName(rs) <> "Recordset" then lcErrorMsg = "

A pesquisa de "" & strQuery & "" não retornou nenhum documento.

" lcErrorMsg = lcErrorMsg & "Por favor, tente novamente.

" End If Function RunQuery(lcQuery,lcVirtual) if TypeName(lcVirtual) <> "String" then lcVirtual = "/" End If if TypeName(lcQuery) <> "String" then Set RunQuery = nothing Exit Function End If 'Set objISAdmin = CreateObject("Microsoft.ISAdm") 'if not objISAdmin.IsRunning then ' lcErrorMsg = "

O Serviço de Pesquisa não está disponível no momento

" ' Exit Function 'End If Set oQ=Server.CreateObject("ixsso.Query") ' Os dois acrescimos à query evitam que diretórios _vti ou arquivos _* apareçam nos resultados oQ.query = lcQuery & " &! #vpath *\_vti_* &! #vpath *\_new* &! #filename _*" ' Allows you to specify which page properties are returned in the recordset oQ.columns = "Vpath,DocTitle,Filename,Write,Characterization,DocKeyWords,DocAuthor,Rank,Size,DocSubject" ' Other properties: Contents, hitcount, Path, DocAuthor oQ.SortBy = "Rank [d]" oQ.MaxRecords = 100 oQ.Catalog = "d:\web\brnt3sp269\htdocs" Set oU=Server.Createobject("ixsso.util") ' Add a few directories for searching - customise for your structure. 'oU.AddScopeToquery oQ,"/asphelp","shallow" 'oU.AddScopeToquery oQ,"/asphelp/scripting","deep" 'oU.AddScopeToquery oQ,"/asphelp/hosting","deep" oU.AddScopeToquery oQ,"/portal","deep" Set rs=oQ.CreateRecordset("nonsequential") if TypeName(rs) <> "Recordset" then Set RunQuery = nothing exit function End If if rs.RecordCount < 1 then Set RunQuery = nothing else ' Return result RecordSet Set RunQuery = rs End If End Function %> <%If Len(lcErrorMsg) > 0 then %> <%= lcErrorMsg %> <% End If %> <% If lcErrorMsg = "" Then intRes = Request("r") intRecordCount = rs.recordcount intResTop = 1 intResBot = intRes + 10 If intRecordCount < intRes + 10 Then intResBot = intRecordCount If intRes > 0 Then intResTop = intRes + 1 %>

Resultados da Pesquisa

<%= intResTop %> a <%= intResBot %> de <%= intRecordCount %> resultados para: "<%= strQuery %>"

<% Call WriteNav() %>

<% If intRes > 1 Then For a = 1 to intRes ' rs.MoveNext i = i + 1 Next End If rs.Move(Request("r")) Do While NOT rs.eof If rs("DocTitle") <> "" Then strTitle = rs("DocTitle") Else strTitle = rs("filename") 'rs.MoveNext 'Loop End If strPath = rs("vPath") i = i + 1 b = b + 1 %> <% If b = 10 Then Exit Do rs.MoveNext loop rs.Close %>
<%= i %>. <%=Fix(rs("rank")/10)%>% <%=strTitle%>
http://www.espirito.org.br<%=strPath%>
<% If rs("Characterization") <> "" Then %> Sumário: "<%= rs("Characterization") %>" <% End If %> <% If rs("DocKeyWords") <> "" Then %> Palavras-chave: <%= rs("DocKeyWords") %> <% End If %> <% If rs("Write") <> "" Then %> Atualização: <%= rs("Write")%> <% End If %> <% If rs("DocAuthor") <> "" Then %> Autor: <%= rs("DocAuthor") %> <% End If %> <% If rs("Size") <> "" Then %> Tamanho: <%= rs("Size") %> bytes <% End If %> <% If rs("DocSubject") <> "" Then %> Assunto: <%= rs("DocSubject") %> <% End If %>
<% End If %>

<% Call WriteNav() %>

<% End If 'Page Navigation Display Subroutine Sub WriteNav() %> <% If intRecordCount > 10 Then %>
<% If intRes > 0 Then %> << Página Anterior <% Else %>   <% End If %> <% intPages = Fix(intRecordCount / 10) %> <% If intRecordCount > (intPages * 10) Then intPages = intPages + 1 %> <% For a = 1 to intPages %> <% If ((a * 10) - 10) = CInt(intRes) OR (a = 1 AND intRes = 0) Then%> <%= a %> <% Else %> <%= a %> <% End If %> <% Next %>   <% If intRecordCount > (intRes + 10) Then %> Próxima Página >> <% Else %>   <% End If %>
<% End If %> <% End Sub %>

Outras Ferramentas de Pesquisa

Página principal | Mapa do Site | Pesquisa no Site | Categorias
Webmaster: webmaster@espirito.com.br Revisado em: 24-ago-2004 09:57.