Foros del Web » Programación para mayores de 30 ;) » Programación General »

Indexing Service

Estas en el tema de Indexing Service en el foro de Programación General en Foros del Web. Estoy tratado de usar Indexing Services como search engine para el web de la empresa para la que trabajo. Todo funciona bien pero los resultados ...
  #1 (permalink)  
Antiguo 29/10/2003, 21:28
Rican
Invitado
 
Mensajes: n/a
Puntos:
Indexing Service

Estoy tratado de usar Indexing Services como search engine para el web de la empresa para la que trabajo. Todo funciona bien pero los resultados son muy amplios y me gustaria hacerlo un poco mas especifico. Se que estan ciertos tipos de wildcards que uno puede entrar para esto pero me gustaria hacerlo desde el script sin que el usuario tenga que escribir el wildcard. Cualquier recomendacion es aceptada. Mil gracias...

Aqui esta el script que estoy usando..

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<html>

<head>

<title>Advanced Search</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>



<body>

<table width="100%" height="100%">

<tr>

<td><!-- #INCLUDE VIRTUAL = "/top_menu.asp" --></td>

</tr>

<tr>

<td width=100% height="100% align="center">

<table width="80%" height="100%" align="center" border="1" cellpadding="0" cellspacing="0" background="images/furlflagltbkg.jpg">

<tr>

<td>

<center>

<form action="search.asp" method="get">

<input name="query" type="text"/>

<input type="submit" value="Search" />

</form>

</td>

</tr>

<tr>

<td>





<%

Dim strQuery ' The text of our query

Dim objQuery ' The index server query object

Dim rstResults ' A recordset of results returned from I.S.

Dim objField ' Field object for loop



' Retreive the query from the querystring

strQuery = Request.QueryString("query")



' If the query isn't blank them proceed

If strQuery <> "" Then

' Create our index server object

Set objQuery = Server.CreateObject("IXSSO.Query")



' Set it's properties

With objQuery

.Catalog = "Web" ' Catalog to query

.MaxRecords = 15 ' Max # of records to return

.SortBy = "rank [d]"

.Columns = "filename, path, vpath, write, " _

& "characterization, DocTitle, DocAuthor, " _

& "rank, hitcount"



' Build our Query: Hide admin page and FPSE pages

strQuery = "(" & strQuery & ")" _

& " AND NOT #filename = *admin*" _

& " AND NOT #path *\_vti_*" _

& " AND NOT #path *.inf*" _

& " AND NOT #path *.doc* " _

& " AND NOT #path *.txt*" _





' Uncomment to only look for files modified last 5 days

'strQuery = strQuery & " AND @write > -5d"



.Query = strQuery ' Query text

End With



' To set more complex scopes we use the utility object.

' You can call AddScopeToQuery as many times as you need to.

' Shallow includes just files in that folder. Deep includes

' subfolders as well.

'

'Dim objUtility

'Set objUtility = Server.CreateObject("IXSSO.Util")

'objUtility.AddScopeToQuery objQuery, "c:\inetpub\wwwroot\indexserver", "shallow"

'objUtility.AddScopeToQuery objQuery, "c:\inetpub\wwwroot\indexserver\content", "shallow"

'Set objUtility = Nothing



' Get a recordset of our results back from Index Server

Set rstResults = objQuery.CreateRecordset("nonsequential")



' Get rid of our Query object

Set objQuery = Nothing



' Check for no records

If rstResults.EOF Then

Response.Write "Sorry. No results found."

Else

' Print out # of results

Response.Write "<p><strong>"

Response.Write rstResults.RecordCount

Response.Write "</strong> results found:</p>"



' Loop through results

Do While Not rstResults.EOF

' Loop through Fields

' Pretty is as pretty does... good enough:

%>

<p>

<% If rstResults.Fields("doctitle") = "" Then %>

<strong><a href="<%= PathToVpath(rstResults.Fields("path")) %>"><%= PathToVpath(rstResults.Fields("path")) %></a></strong><br />

<% Else %>

<strong><a href="<%= PathToVpath(rstResults.Fields("path")) %>"><%= rstResults.Fields("doctitle") %></a></strong><br />

<% End If %>

&nbsp;&nbsp;&nbsp;<em>Author:</em> <%= rstResults.Fields("docauthor") %><br />

&nbsp;&nbsp;&nbsp;<em>Last Modified:</em> <%= rstResults.Fields("write") %><br />

&nbsp;&nbsp;&nbsp;<em>Description:</em> <%= rstResults.Fields("characterization") %><br />

</p>

<hr />

<%



' Move to next result

rstResults.MoveNext

Loop



rstResults.MoveFirst

Response.Write "<pre>"

'Response.Write rstResults.GetString()

Response.Write "</pre>"

End If



' Kill our recordset object

Set rstResults = Nothing

End If

%>







<%

Function PathToVpath(strPath)

Const strWebRoot = "w:\inetpub\wwwroot\"



Dim strTemp



strTemp = strPath



strTemp = Replace(strTemp, strWebRoot, "\")

strTemp = Replace(strTemp, "\", "/")



PathToVpath = strTemp

End Function

%>

</center>

</td>

</tr>

</table>

</td>

</tr>

<tr>

<td><!-- #INCLUDE VIRTUAL = "/legal.asp" --></td>

</tr>

</table>

</body>

</html>
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 08:32.