|
||||||||
| |
<%
if Request.form("req")<>"" then
search=trim(Request.form("req"))
session("searchreq")=replace(search,"'","")
end if
SearchString=session("searchreq")
SrchStrLen = len(SearchString)
if left(SearchString, 1) = chr(34) then
flag=true
SrchStrLen = SrchStrLen-1
SearchString = right(SearchString, SrchStrLen)
end if
if right(SearchString, 1) = chr(34) then
flag=true
SrchStrLen = SrchStrLen-1
SearchString = left(SearchString, SrchStrLen)
end if
if flag=true then
stmt = "SELECT " & _
" Create,Characterization,DocTitle,filename,Vpath,size,path,HitCount" & _
" FROM SCOPE(' SHALLOW TRAVERSAL OF ""/annapolis_site"",""/annapolis_site/about"",""/annapolis_site/case"",""/annapolis_site/faq"",""/annapolis_site/gsa"",""/annapolis_site/partner"",""/annapolis_site/product"",""/annapolis_site/reseller"",""/annapolis_site/service"" ')" & _
" WHERE CONTAINS(' " & chr(34) & SearchString & chr(34) & " ')>0"
session("searchreq")=chr(34) & SearchString & chr(34)
else
bor=Instr(SearchString,"OR")
band=Instr(SearchString,"AND")
bnot=Instr(SearchString,"NOT")
bnear=Instr(SearchString,"NEAR")
sor=Instr(SearchString,"|")
sand=Instr(SearchString,"&")
snot=Instr(SearchString,"!")
snear=Instr(SearchString,"~")
if bor<>0 or band<>0 or bnot<>0 or sor<>0 or snot<>0 or sand<>0 or snear<>0 or bnear<>0 then
stmt="Select Create,Characterization,DocTitle,filename,Vpath,size,path,HitCount from SCOPE(' SHALLOW TRAVERSAL OF ""/annapolis_site"",""/annapolis_site/about"",""/annapolis_site/case"",""/annapolis_site/faq"",""/annapolis_site/gsa"",""/annapolis_site/partner"",""/annapolis_site/product"",""/annapolis_site/reseller"",""/annapolis_site/service"" ') where CONTAINS('" & SearchString & "') > 0"
else
stmt="Select Create,Characterization,DocTitle,filename,Vpath,size,path,HitCount from SCOPE(' SHALLOW TRAVERSAL OF ""/annapolis_site"",""/annapolis_site/about"",""/annapolis_site/case"",""/annapolis_site/faq"",""/annapolis_site/gsa"",""/annapolis_site/partner"",""/annapolis_site/product"",""/annapolis_site/reseller"",""/annapolis_site/service"" ') where FREETEXT(contents,'" & SearchString & "') > 0"
end if
session("searchreq")=SearchString
end if
set con=server.CreateObject("adodb.connection")
set rs=server.CreateObject("adodb.recordset")
'con.Open "provider=msidxs;Data Source=annapolis"
con.Open "provider=msidxs;"
rs.CursorType=3
thispage = cint(Request.QueryString("thispage"))
rs.PageSize = 5
rs.Open stmt,con
dim servername
servername=Request.Servervariables("SERVER_NAME")
If thispage < 1 Then
thispage = 1
end if
set objrec=con.Execute (stmt)
if not objrec.EOF then
while not objrec.EOF
count=count+1
objrec.movenext
wend
set objrec=nothing
end if
rowcount=0
if not rs.eof then
rs.AbsolutePage=thisPage
Response.Write "Found " & count & " Matches " if ((thispage=1) and (thispage = rs.PageCount)) then Response.Write "Showing "&thispage&" - "&rs.RecordCount &" of "&rs.RecordCount&" " Response.Write "" Response.Write "" else if thispage=1 then Response.Write "Showing "&thispage&" - "&thispage*rs.PageSize&" of "&rs.RecordCount&" " elseif thispage = rs.PageCount then Response.Write "Showing "&(thispage-1)*rs.PageSize+1&" - "&rs.RecordCount&" of "&rs.RecordCount&" " else Response.Write "Showing "&(thispage-1)*rs.PageSize+1&" - "&thispage*rs.PageSize&" of "&rs.RecordCount&" " end if Response.write " | "
if not thispage = 1 then
Response.Write " "
end if
if not thispage = rs.PageCount then
Response.Write " "
end if
end if
Response.Write " |