Ver Mensaje Individual
  #1 (permalink)  
Antiguo 13/01/2004, 18:16
wpp
 
Fecha de Ingreso: noviembre-2003
Mensajes: 50
Antigüedad: 21 años, 7 meses
Puntos: 0
Carga lenta de buscador en ASP.

Pues que cuando le doy a buscar tarda un montón en recorrer el directorio y mostrar las respuestas y por tanto las palabras encontradas, me podéis ayudar. (tarda hasta 2 minutos).

CÓDIGO QUE BUSCA:
Código:
<% 
Response.Buffer = True

Const fsoForReading = 1 

Dim strSearchText 
strSearchText = Request("SearchText") 

'Now, we want to search all of the files 
Dim objFSO 
Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 

Dim objFolder 
Set objFolder = objFSO.GetFolder(Server.MapPath("/history/")) 

Dim objFile, objTextStream, strFileContents, bolFileFound 
bolFileFound = False 

For Each objFile in objFolder.Files 
   If Response.IsClientConnected then 
     Set objTextStream = objFSO.OpenTextFile(objFile.Path,fsoForReading) 

     strFileContents = objTextStream.ReadAll 

     If InStr(1,strFileContents,strSearchText,1) then 
       Response.Write "<font face=Verdana>◊◊ </font><A HREF=""/history/" & objFile.Name & _ 
       """ target=_blank>" & objFile.Name & "</A><br>" 

       bolFileFound = True 
     End If 

     objTextStream.Close 
   End If 
Next 

if Not bolFileFound then Response.Write "No hay resultados para esa palabra..." 

Set objTextStream = Nothing 
Set objFolder = Nothing 
Set objFSO = Nothing 
%>