<% Response.CacheControl = "no-cache" Response.AddHeader "Pragma", "no-cache" Response.Expires = -1 %> <% ' Start Comments ' Section Name : 4.4.1 Keyword Based Search 'Page/form name: search_results.asp 'Purpose: 'Date of Creation 13-07-2001 'Date Modified:15-07-2001 ' Time Modified :2:30 PM Sunday 'Author: Navin Sabharwal ' End Comments %> <% 'Response.Buffer = false 'Security Code Dim strPageCode strPageCode="44KEY02" dim rsTemp dim EncodedSectionName EncodedSectionName=Server.URLEncode("Keyword Search") 'pagination code 'If PageNo is not there is querystring then set it to 1 if len(trim(Request("pageno"))) > 0 then intpageno=Request("pageno") else intpageno=1 end if 'varpagesize=1 varcachesize=10 %> Search Results - <%=Application("Title")%>
Home > Search
Search
Keywords
 
" size="20" maxlength="30"> Search Tips
  Search from Directories 
<% ' Pagination from Parameter Table 'set rsParameter = Server.CreateObject("ADODB.Recordset") 'sqlParameter = "Select * from parameter where parametercode='PAG'" 'Set rsParameter = objConn.execute(sqlParameter) 'varpagesize=Cint(rsParameter("parametervalue")) varpagesize = Application("NumRecords") 'ON Error Resume Next Set objQuery = Server.CreateObject("ixsso.query") Set objUtil = Server.CreateObject("ixsso.util") my_keyword=request("keyword3") ' keyword search 'myquery=myquery & "$CONTENTS " & my_keyword myquery = myquery & my_keyword 'Exclude specific folders %> <% ' 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 ' UnComment This Line After Incorporating .gif,.jpeg, .avi etc myquery=myquery & " and not #filename *.|(txt|,inc|,jpg|,avi|,jpeg|,gif|,mdb|,cnt|,class|,toc|,css|)" 'myquery="$CONTENTS dsn" objQuery.Query=myQuery objQuery.Columns = "vpath, Path, DocTitle, Filename, Characterization, Contents,DocKeyWords, Rank" 'objquery.Columns = "DocTitle, vpath, filename, size, write, characterization, rank" objQuery.SortBy = "Rank [d]" objQuery.MaxRecords = 200 objquery.catalog="ITPO_USER" ' Change The Catalogue Name 'objUtil.AddScopeToQuery objQuery, "/", "deep" objquery.LocaleID = objutil.ISOToLocaleID("EN-US") Set rstemp = objQuery.CreateRecordSet("nonsequential") ' if Err <> 0 then response.redirect "/inc/commoninc/error.asp?section=" & EncodedSectionName & "&errortype=" & "err_record" end if 'On error goto 0%>
<% Rstemp.PageSize = varpagesize if (intpageno * 10) > rsTemp.recordcount then itot=rsTemp.recordcount else itot=intpageno * 10 end if if rsTemp.recordcount > 0 then istart=((intpageno -1) * 10) +1 else istart=0 end if %> <%if istart > 0 then Response.Write "" & istart & " to " & itot & " of " end if%> <%=rsTemp.recordcount%> Matching Records
 Search Results for Keyword <%=Server.HTMLEncode(Request("keyword3"))%>
<%if not rstemp.eof and not rstemp.bof then Rstemp.PageSize = varpagesize Rstemp.absolutepage =intpageno Dim maxpagerecs ' Temporary variable , intpagesize is the pagesize from parameter table maxpagerecs=0 Do while not (rstemp.eof) and (maxpagerecs < 10) ' Function for Content Management Handling str=rstemp("vpath") abc= instr(1,str,"itpo/UploadData",1) abc1 = instr(1,str,"/prodcat/",1) abc2 = instr(1,str,"",1) if abc > 0 then strresult = checkcontent(str) strresult = "/contentmgmt/Desktops2.asp?compid=itpo&itemcode=" & strresult elseif abc1 > 0 then strresult = checkcontent1(str) else strresult = str end if 'prodcat/Desktops.asp?itemcode=I005&compid=AM-020014/99&Product=100 ' End Function %> <%rstemp.movenext maxpagerecs=maxpagerecs+1 Loop%> <% Else %> <% End If %>
<% if len(trim(rsTemp("DocTitle"))) >0 then %> <%else temptitle="Untitled" %> <%end if%>
<%=rstemp("characterization")%>
<% call pagination(rstemp.pagecount) %>
No Matching Records found
<% ' clean up rstemp.close set rstemp=nothing Set objQuery = nothing Set objUtil = nothing %> <% Function pagination(rsmaxpages) Dim intstartpage ' starting page Dim intendpage ' Ending Page Dim intPageNo 'intpageno the Current Page No. Dim Maxpages ' set it to the recordset.pagecount Dim Maxpageset ' set it to one set Dim pagestring ' set it to pagestring ' Setting Maxpages = Recordset Maxpages maxpages=rsmaxpages ' If PageNo is not there is querystring then set it to 1 if len(trim(Request("pageno"))) > 0 then intpageno=Request("pageno") else intpageno=1 end if ' Defining the PageString Here ' Change this pagestring="search_results.asp?keyword3=" & Server.URLEncode(Request("keyword3")) & "&pageno=" ' Defining the MaxPageSet Here ' Change This maxpageset=10 'Initializing maxpages to the Record ' Change the Recordset Name maxpages = rsmaxpages if ((intpageno/maxpageset)=(intpageno\maxpageset)) then if (Cint(intendpage)>=Cint(maxpages)) then intendpage=maxpages else intendpage = ((maxpageset)*(intpageno\maxpageset)) intstartpage = intendpage-maxpageset+1 end if else intstartpage = ((maxpageset)*(intpageno\maxpageset))+1 intendpage = intstartpage+maxpageset-1 end if ' For Restricting the records in case the maxpageset is more than the maxpages if maxpageset > maxpages then intendpage = maxpages end if ' For Restricting the records in case the intendpage is more than the maxpages if intendpage > maxpages then intendpage = maxpages end if if (Cint(intstartpage)" if not(Cint(intpageno)=1) then Response.write "" & "«Prev" & "" & "  " end if For I = Cint(intstartpage) to Cint(intendpage) if Not (maxpages=1) then if (I = Cint(intpageno)) then ' if it is the current page disable the Link Response.write I & "  " else Response.write "" & I & "" & "  " end if End if Next ' Next Processing if not(Cint(intpageno)>=Cint(maxpages)) then Response.write "" & "Next »" & "" & "  " end if Response.write "" End if end function %> <% function checkcontent(str) dim endno dim startno dim found i = len(str) do while i >0 abc= mid(str,i,1) if abc = "/" then if found = 0 then endno = i found = 1 elseif found = 1 then startno = i+1 exit do end if end if i = i-1 loop noofchars= endno-startno checkcontent = mid(str,startno,noofchars) end function %> <% function checkcontent1(str) a1 = instr(str,"usrdata") a1=a1+8 compname = mid(str,a1,12) a2 = instr(str,"/prodcat/") a2=a2+9 prodcode = mid(str,a2,4) Dim rs set rs = CreateObject("ADODB.Recordset") Dim qry qry ="select itemname from contentmaster where itemcode=parentitemcode and companycode ="&_ "'" & compname & "'" & "and parentitemcode =" & _ " (select distinct parentitemcode from contentmaster where companycode =" & _ "'" & compname & "'" & " and itemcode =" & "'" & prodcode & "')" rs.open qry, ObjConn if not rs.eof then prodname = rs(0) else prodname = " " end if result = "/prodcat/Desktops.asp?itemcode=" & prodcode & "&compid=" & compname & "&Product=" & prodname tmp=instr(result,"am-") 'response.write tmp 'response.write result tmp=tmp+3 tmpvar = mid(result,1,tmp) 'response.write tmpvar tmp=tmp+1 result1=Replace(result, "-", "/",tmp, 1,1) 'response.write result1 result1 = tmpvar & result1 'response.write result1 'response.write server.urlencode("/") checkcontent1 = result1 rs.close set rs = nothing end function %>