Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Motore di Ricerca

Il seguente codice si connette ad index server per cercare all'interno del sito tramite il componente ixsso.query
E' possibile escludere una serie di cartelle, di file e di estensioni dalla ricerca


<%
Set objQuery = Server.CreateObject("ixsso.query")
Set objUtil = Server.CreateObject("ixsso.util")
my_keyword=request("keyword")

' keyword search
myquery=myquery & "$CONTENTS " & my_keyword

' Escludo delle cartelle
myquery=myquery & " and not #path = *\inetpub\iissamples\* "
myquery=myquery & " and not #path = *\winnt\help\iishelp\* "
myquery=myquery & " and not #path = *\winnt\system32\inetsrv\iisadmin\* "

' Escludo dei file
myquery=myquery & " and not #filename indexmaster.asp"
myquery=myquery & " and not #filename index.asp"
myquery=myquery & " and not #filename indexold.asp"

' Escludo delle estensioni
myquery=myquery & " and not #filename *.|(inc|,mdb|,cnt|,class|,toc|,css|)"

objQuery.Query=myQuery

objquery.Columns = "DocTitle, vpath, filename, size, write, rank"

objQuery.SortBy = "Rank [d]"
objQuery.MaxRecords = 50
objquery.catalog="web"
'objUtil.AddScopeToQuery objQuery, "/", "deep"
objquery.LocaleID = objutil.ISOToLocaleID("EN-US")

linebr="<br>" & vbcrlf
Set rstemp = objQuery.CreateRecordSet("nonsequential")

if not rstemp.eof then
  dim i
  i=rstemp.RecordCount
  if i>=50 then
    Response.write "<b>Piu' di 50 corrispondenze trovate<hr></b>"
  else
    Response.write "<b>" & i & " Corrispondenze trovate<hr></b>"
  end if
  Do Until rstemp.eof
    For Each key in rstemp.fields
    keyname=lcase(key.name)
    Select Case keyname
      Case "vpath"
        response.write "<b>link: </b></br>"
        response.write "<a href='"
        response.write key
        response.write "'>http://www.morpheusweb.it" & key & "</a>" & linebr
      Case"rank"
        key=key/10
        key=key&"%"
        response.write "<b>rank: </b></br>"
        response.write key
      Case Else
        response.write "<b>" & keyname & ":</b>" & linebr
        response.write key & linebr
      End Select
    Next
    response.write "<br><hr>"
    rstemp.movenext
  Loop
  rstemp.close
  set rstemp=nothing
  Set objQuery = nothing
  Set objUtil = nothing
  response.write "<a href=search.asp>Nuova Ricerca...</a>"
else
  %>
  <a href="search.asp">Non sono stati trovati documenti</a>
  <%
end if
%>


Scarica il Codice...


Stampa la pagina


 








Inizio pagina

risorse per webmaster