Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Appendix B: Related Web/Com Technologies
     [next Lesson]  Commerce and ASP

Index Server Access via ADO by Charles Carroll

The script below demonstrates how Index Server can be accessed via ADO to do simple searches.

   filename=/learn/test/iskeyword.asp

<Test Script Below>


<html><head>
<title>iskeyword.asp</title>
</head><body bgcolor="#FFFFFF">
<Form action = "iskeywordRespond.asp" method="get">
Choose The Word You Want to Search For::<p>
Search Word: <Input NAME="Keyword" size ="30"><br>
<Input type="submit" value="Find The Documents!">
</form>
</body></html>

The iskeywordrespond.asp looks like this:

   filename=/learn/test/iskeywordrespond.asp

<Test Script Below>


<html><head>
<title>iskeywordrespond.asp</title>
</head>
<body>
<%
Set objQuery = Server.CreateObject("ixsso.query")
Set objUtil = Server.CreateObject("ixsso.util")
my_keyword=request("keyword")

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

' Exclude specific folders
%>
<!--#include virtual="/search/exclude.asp"-->

<%
' Exclude specific filenames
myquery=myquery & " and not #filename indexmaster.asp"
myquery=myquery & " and not #filename index.asp"
myquery=myquery & " and not #filename indexold.asp"

' Exclude specific extensions
myquery=myquery & " and not #filename *.|(txt|,inc|,htm|,mdb|,cnt|,class|,toc|,html|,css|)"

'myquery="$CONTENTS dsn"

objQuery.Query=myQuery
objQuery.Columns = "Vpath, DocTitle, Filename, Characterization, Contents,DocKeyWords, Rank"
'objquery.Columns = "DocTitle, vpath, filename, size, write, characterization, rank"
objQuery.SortBy = "Rank [d]"
objQuery.MaxRecords = 50
objquery.catalog="learnasp"
'objUtil.AddScopeToQuery objQuery, "/", "deep"
objquery.LocaleID = objutil.ISOToLocaleID("EN-US")


linebr="<br>" & vbcrlf
Set rstemp = objQuery.CreateRecordSet("nonsequential")
   DO UNTIL rstemp.eof
        FOR EACH key in rstemp.fields
            keyname=lcase(key.name)
            SELECT CASE keyname
                CASE "vpath"
                    response.write "<a href='"
                    response.write key
                    response.write "'>" & key & "</a>" & linebr
                CASE ELSE
                    response.write "<b>" & keyname & ":</b>" & linebr 
                    response.write key & linebr
            END SELECT
        NEXT
        response.write "<br><hr>"
      rstemp.movenext
   LOOP
   ' clean up
   rstemp.close
   set rstemp=nothing
    Set objQuery = nothing
    Set objUtil = nothing
%>
</body>
</html>

It has to exclude many folders on my site and the following file excludes directories:

   filename=/search/exclude.asp

<Test Script Below>


<%

myquery=myquery & " and not #Vpath *\*_* "
myquery=myquery & " and not #Vpath *\_contents* "
myquery=myquery & " and not #Vpath *\_raw* "
myquery=myquery & " and not #Vpath *\_vti_* "
myquery=myquery & " and not #Vpath *\_vti_cnf* "

myquery=myquery & " and not #Vpath *\ads* "
myquery=myquery & " and not #Vpath *\aspace* "
myquery=myquery & " and not #Vpath *\attilan* "
myquery=myquery & " and not #Vpath *\advice\draft* "

'myquery=myquery & " and not #Vpath *\asplists* "
myquery=myquery & " and not #Vpath *\asparchive* "
myquery=myquery & " and not #Vpath *\archive* "

myquery=myquery & " and not #Vpath *\aspelite* "
myquery=myquery & " and not #Vpath *\aspmagazine\new* "
myquery=myquery & " and not #Vpath *\aspfuture* "
myquery=myquery & " and not #Vpath *\asptraining* "
myquery=myquery & " and not #Vpath *\aspynews* "
myquery=myquery & " and not #Vpath *\activeserverpages* "

myquery=myquery & " and not #Vpath *\contribute* "
myquery=myquery & " and not #Vpath *\cst* "
myquery=myquery & " and not #Vpath *\charlescarroll\draft* "
myquery=myquery & " and not #Vpath *\charlesteam* "


myquery=myquery & " and not #Vpath *\dcline* "
myquery=myquery & " and not #Vpath *\drafts* "

myquery=myquery & " and not #Vpath *\experiments* "
myquery=myquery & " and not #Vpath *\elders* "

myquery=myquery & " and not #Vpath *\ff* "
myquery=myquery & " and not #Vpath *\finito* "


myquery=myquery & " and not #Vpath *\genericdb* "
myquery=myquery & " and not #Vpath *\glorantha* "

myquery=myquery & " and not #Vpath *\finito* "
myquery=myquery & " and not #Vpath *\future* "

myquery=myquery & " and not #Vpath *\home* "
myquery=myquery & " and not #Vpath *\how* "

myquery=myquery & " and not #Vpath *\images* "

myquery=myquery & " and not #Vpath *\library* "
myquery=myquery & " and not #Vpath *\learnasp* "
myquery=myquery & " and not #Vpath *\learn\cover* "
myquery=myquery & " and not #Vpath *\learn\securityrisk* "

myquery=myquery & " and not #Vpath *\naoko* "
myquery=myquery & " and not #Vpath *\nda* "

myquery=myquery & " and not #Vpath *\orcsweb* "

myquery=myquery & " and not #Vpath *\private* "
myquery=myquery & " and not #Vpath *\perlscript* "

myquery=myquery & " and not #Vpath *\quickstart* "

myquery=myquery & " and not #Vpath *\reference* "
myquery=myquery & " and not #Vpath *\redesign* "

myquery=myquery & " and not #Vpath *\search* "
myquery=myquery & " and not #Vpath *\searchasplists* "
myquery=myquery & " and not #Vpath *\secret* "
myquery=myquery & " and not #Vpath *\sites* "
myquery=myquery & " and not #Vpath *\search* "
myquery=myquery & " and not #Vpath *\speedsitelaws* "
myquery=myquery & " and not #Vpath *\start* "
myquery=myquery & " and not #Vpath *\students* "
myquery=myquery & " and not #Vpath *\surprise* "

myquery=myquery & " and not #Vpath *\trash* "
myquery=myquery & " and not #Vpath *\test* "
myquery=myquery & " and not #Vpath *\team* "

myquery=myquery & " and not #Vpath *\upload* "
myquery=myquery & " and not #Vpath *\upload\tests* "

myquery=myquery & " and not #filename indexmaster.asp"
myquery=myquery & " and not #filename index.asp"
myquery=myquery & " and not #filename indexold.asp"
myquery=myquery & " and not #filename *.|(txt|,inc|,htm|,mdb|,cnt|,class|,toc|,html|,css|)"
'myquery=myquery & " and #filename *.asp"
%>

There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.