tempad
ReadyGo!技术成就梦想 >>服务器 >> 200分求index server的站内搜索asp源代码!!急用!

200分求index server的站内搜索asp源代码!!急用!

ReadyGo!技术成就梦想 网络搜索 efish 2008-1-14 1:24:10

200分求index server的站内搜索asp源代码!!急用!

楼主Alexander(药匣子)2002-03-13 12:34:06 在 Web 开发 / ASP 提问

包括前端的表单和后台处理。  
  功能越强大的越好!不要给我简单的,我自己写得太简单。  
  ~~~~~~~~~~~~~~~~~  
  可以实现复杂查找,结果中的关键词醒目提示,等等。  
  如果有iis4的sample也行!  
  请给我下载地址或发到我的邮箱  
  alex@chinese.com  
  谢谢,一定给分 问题点数:200、回复次数:10Top

1 楼spacener(空中楼阁)回复于 2002-03-13 12:45:45 得分 200

你需要创建如下两个页面文件:  
   
  1、独立的搜索页面   search.htm(数据库页面,你也可以加上更多的数据):  
   
  将如下的代码加入HTML的<body>区(只按所给格式修改红色字部分):  
   
  <!--   代码开始-->  
  <form   NAME="database">  
  <input   type="hidden"   name="list"  
  value="http://campo.3322.net~草原孤星-轻轻松松做网页|javascript   java   scripts   free   campo   网页制作   免费cgi服务   dreamweaver   fireworks   prontpage   flash   html   css^手把手教你做网页,让你成为真正的高手!*第2个页面的URL~第2个页面的标题|关键字,用空格隔开^该页面的描述!*第3个页面的URL~第3个页面的标题|关键字用空格隔开写^该页面描述!*第4个页面的URL~第三个页面的标题|关键字,用空格隔开^该页面的描述!*第5个页面的URL~第五个页面的标题|关键字用空格隔开写^该页面描述!*">  
  </form>  
  <!--   以下代码不要变动-->  
  <script   language="JavaScript">  
  <!--  
  function   Page(url,title,keywords,description)   {  
  while   ((url.length   >   0)   &&   (url.charAt(0)   ==   "   "))   {  
  url   =   url.substring(1,url.length);  
  }  
  this.url   =   url;  
  while   ((title.length   >   0)   &&   (title.charAt(0)   ==   "   "))   {  
  title   =   title.substring(1,title.length);  
  }  
  this.title   =   title;  
  this.keywords   =   keywords;  
  this.description   =   description;  
  return   this;  
  }  
  function   Database()   {  
  var   pos   =   0;  
  while   ((pos1   =   amorphous.indexOf("~",pos))   !=   -1)   {  
  pos2   =   amorphous.indexOf("|",pos1+1);  
  pos3   =   amorphous.indexOf("^",pos2+1);  
  pos4   =   amorphous.indexOf("*",pos3+1);  
  if   ((pos2   !=   -1)  
  &&   (pos2   <   pos3)   &&   (pos3   <   pos4)  
  &&   (pos4   <=   amorphous.indexOf("*",pos)))   {  
  this   =   new   Page(amorphous.substring(pos,pos1),  
  amorphous.substring(pos1+1,pos2),  
  amorphous.substring(pos2+1,pos3),  
  amorphous.substring(pos3+1,pos4));  
  pos   =   pos4+1;  
  }   else   {   //   error   reading   amorphous   database  
  if   (pos+30   <=   amorphous.length)  
  alert("Error   reading   in   amorphous   database   around   ""  
  +   amorphous.substring(pos,pos+30)   +   """);  
  pos   =   amorphous.indexOf("*",pos)   +   1;  
  }  
  }  
  return   this;  
  }  
  function   search(str)   {  
  menu_length   =   0;  
  temp   =   new   Object();  
  temp_length   =   0;  
  words_length   =   0;  
  words   =   new   Object();  
  pos   =   0;  
  while   ((pos   =   str.indexOf("   "))   !=   -1  
  &&   and_search   !=   "exact")   {  
  words   =   str.substring(0,pos);  
  if   (words.length   >   0)  
  words_length++;  
  if   (str.length   ==   1)  
  str="";  
  else  
  str   =   str.substring(pos+1,str.length);  
  }  
  if   (str.length   >   0)  
  words   =   str;  
  for   (q=0;q<words_length;q++)   {  
  temp_length   =   0;  
  str   =   words.toLowerCase();  
  len   =   (and_search=="and"&&q>0?menu_length:database_length);  
  for   (n=0;   n<len;   n++)   {  
  if   (and_search=="and"&&q>0)   {  
  combo   =   (menu.title   +   "   "   +   menu.description  
  +   "   "   +   menu.keywords).toLowerCase();  
  }   else   {  
  combo   =   (database.title   +   "   "   +   database.description  
  +   "   "   +   database.keywords).toLowerCase();  
  }  
  if   (combo.indexOf(str)   !=   -1)   //   found  
  temp   =   (and_search=="and"&&q>0?menu:database);  
  }  
  if   (and_search!="and"   &&   q>0)   {  
  added   =   0;  
  for   (i=0;i<temp_length;i++)   {  
  duplicate   =   false;  
  for   (j=0;j<menu_length&&!duplicate;j++)   {  
  if   (menu   ==   temp)   {  
  duplicate   =   true;  
  }  
  }  
  if   (!duplicate)  
  menu   =   temp;  
  }  
  menu_length   +=   added;  
  }   else   {  
  for(h=0;h<temp_length;h++)  
  menu   =   temp;  
  menu_length   =   temp_length;  
  }  
  }  
  }  
  function   entry()   {  
  if   ((document.entryform.keyword.value.length   ==   0)  
  ||   (document.entryform.keyword.value   ==   "   "))   {  
  alert("你必须填写关键字!");  
  return   false;  
  }  
  and_search   =   (document.entryform.and_or.selectedIndex   ==   0?"and":"or");  
  if   (document.entryform.and_or.selectedIndex   ==   2)  
  and_search   =   "exact";  
  location.href   =   location.pathname   +   "?"  
  +   escape(document.entryform.keyword.value)  
  +   (and_search   !=   "or"?"&"+and_search:"");  
  return   false;  
  }  
  function   redWord(str)   {  
  for(r=0;   r<words_length;   r++)   {  
  pos   =   -3;  
  word   =   words.toLowerCase();  
  while   ((pos   =   str.toLowerCase().indexOf(word,pos+3))   !=   -1)   {  
  val   =   pos+word.length;  
  str   =   str.substring(0,pos)   +   "*"  
  +   str.substring(pos,val)   +   "|"  
  +   str.substring(val,str.length);  
  }  
  }  
  pos   =   -16;  
  while   ((pos   =   str.toLowerCase().indexOf("*",pos+16))   !=   -1)  
  str   =   str.substring(0,pos)   +   "<font   color=red>"  
  +   str.substring(pos+1,str.length);  
  pos   =   -7;  
  while   ((pos   =   str.toLowerCase().indexOf("|",pos+7))   !=   -1)  
  str   =   str.substring(0,pos)   +   "</font>"  
  +   str.substring(pos+1,str.length);  
  return   str;  
  }  
   
  var   amorphous   =   document.database.list.value;  
  temp_str   =   amorphous.substring(amorphous.length-2,amorphous.length);  
  if   (temp_str.indexOf("*")   ==   -1)  
  amorphous   +=   "*   ";  
  else  
  amorphous   +=   "   ";   //   amorphous   database   must   have   characters   after   last   asterisk  
   
  database_length   =   0;   //   Netscape   2   fix  
  var   database   =   new   Database();   //   read   in   from   amorphous   database  
   
  menu_length   =   0;   //   Netscape   2   fix  
  var   menu   =   new   Object();  
   
  string   =   "";  
  and_search   =   "or";  
  if   (location.search.length   >   1)   {  
  string   =   unescape(location.search.substring(1,location.search.length));  
  pos   =   0;  
  while   ((pos   =   string.indexOf(""",pos))   !=   -1)   {  
  string   =   string.substring(0,pos)   +   "\\""   +   string.substring(pos+1,string.length);  
  pos   +=   2;  
  }  
  if   (string.substring(string.length-4,string.length)   ==   "&and")   {  
  string   =   string.substring(0,string.length-4);  
  and_search   =   "and";  
  }   else   if   (string.substring(string.length-6,string.length)   ==   "&exact")   {  
  string   =   string.substring(0,string.length-6);  
  and_search   =   "exact";  
  }   else   if   (string.substring(string.length-3,string.length)   ==   "&or")   {  
  string   =   string.substring(0,string.length-3);  
  and_search   =   "or";  
  }  
  search(string);  
  }  
  document.write("<form   name="entryform"   onSubmit="return   entry()">"  
  +"关键词&nbsp;&nbsp;:<input   type="text"   size=22   "  
  +"name="keyword"   value=""+string+"">   "  
  +"<input   type="button"   value="找啦!"   onClick="entry()"><br>搜索选择:<select   name="and_or"   "  
  +"size=1><option"+(and_search=="and"?"   selected":"")+">Search   All   word   "  
  +"(AND)<option"+(and_search=="or"?"   selected":"")+">Search   any   word   "  
  +"(OR)<option"+(and_search=="exact"?"   selected":"")+">Exact   "  
  +"word</select></form><br>");  
  if   (location.search.length   >   1)  
  document.write("查询结果:<br><br>\n");  
   
  for   (n=0;   n<menu_length;   n++)  
  document.write("<a   href=""+menu.url+""target=_blank>"+menu.title  
  +"</a><br>"+redWord(menu.description)+"<br>Keywords:   "  
  +redWord(menu.keywords)+"<p>\n");  
  if   ((menu_length   ==   0)   &&   (location.search.length   >   1))  
  document.write("对不起:你查询的关键字""+string+""没有发现!\n");  
  document.write("<p><a   href=http://campo.3322.net   target=_blank>草原孤星欢迎你的光临!</a>");  
  //   -->  
  </script>  
  <!--   代码结束-->  
   
  2、搜索表单页面index.htm  
   
  将如下代码加入HTML的<body>区:  
   
  <!--   代码开始-->  
  <script   language="JavaScript">  
  <!--  
  //   下面是负责搜索的页面的全路径或相对路径  
  var   search_htm_url   =   "search.htm";  
   
  function   searchPage()   {  
  if   ((document.searchpage.keyword.value.length   ==   0)  
  ||   (document.searchpage.keyword.value   ==   "   "))   {  
  alert("请填入关键字!");  
  }   else   {  
  sel   =   document.searchpage.and_or.selectedIndex;  
  location.href   =   search_htm_url   +   "?"  
  +   escape(document.searchpage.keyword.value)  
  +   (sel==0?"&and":(sel==2?"&exact":"&or"));  
  }  
  return   false;  
  }  
  </script>  
  <form   name="searchpage" onSubmit="return   searchPage()">    
  <p   align="left">关键词&nbsp;   :   <input   type="text"   size=22   name="keyword">   <input   type="button"   value="找啦!"   onClick="searchPage()"   name="search"><br>    
   
  搜索选择:<select   name="and_or"   size=1><option>find   all   words   (AND)<option>find    
  any   word   (OR)<option>exact   match</select></form>    
  <!--   代码结束-->  
  试一下吧!http://campo.3322.net  
  这个网站蛮好的!有你要的!Top

2 楼Alexander(药匣子)回复于 2002-03-13 15:04:48 得分 0

老哥,没有asp的吗?  
  请大家帮忙!Top

3 楼Alexander(药匣子)回复于 2002-03-13 17:39:20 得分 0

没有人知道吗?!Top

4 楼tonnycncn(托尼)(weiw.com)回复于 2002-03-13 22:04:14 得分 0

我已发到你的邮箱里了,请接收!  
  alex@chinese.com    
  Top

5 楼Alexander(药匣子)回复于 2002-03-14 13:12:08 得分 0

to   tonny:  
    老兄,我需要的是利用asp中的index   server提供的组件  
  你那个程序运行巨慢!  
  有没有利用index   server自带属性的?Top

6 楼Alexander(药匣子)回复于 2002-03-14 13:14:26 得分 0

我下面贴一个我自己写的代码  
  我想要的是加进分页,结果高亮度表示,前端表复杂查询的代码  
  这样的代码应该很多呀!尤其是在asp的光盘里  
  请大家帮忙,提供者将得到200分!  
   
   
  <table   width=84%   background="../images/bg_table.gif"   align=center><td   align=center>  
  <form   action="search.asp"   method="post"   name="search1"   id="search1">&nbsp;&nbsp;  
  输入字符串&nbsp;&nbsp;<input   type=text   name=qrystr   >&nbsp;&nbsp;  
  <input   type="submit"   value="搜之!">  
  </form><p>  
  <table   width="85%"   border="0"   align="center"><td><%  
  searchScope="/"  
  localeid="zh-cn"  
  qrystr=request("qrystr")  
  strLen=len(qrystr)  
  if   left(qrystr,1)=chr(34)   then  
  strlen=strlen-1  
  qrystr=right(qrystr,strLen)  
  end   if  
  if   right(qrystr,1)=chr(34)   then  
  strlen=strlen-1  
  qrystr=left(qrystr,strLen)  
  end   if  
  set   objQry=Server.CreateObject("ixsso.Query")  
  set   objUti=Server.CreateObject("ixsso.util")  
  objQry.query=qrystr  
  objQry.sortby="rank"  
  objQry.columns="doctitle,vpath,filename,size,write,characterization,rank"  
  objQry.Maxrecords=200  
  if   searchScope   <>   "/"   then  
  objuti.addscopetoQuery   objQry,searchscope,"deep"  
  end   if  
  if   localeid   <>   ""   then  
  objQry.localeid=objuti.isotolocaleid(localeid)  
  end   if  
  set   rs=objQry.createrecordset("nonsequential")    
  if   not   rs.eof   then  
  response.write"<p>"  
  if   rs.recordcount   <>   -1   then    
  response.write   "共有"   &   rs.recordcount  
  end   if  
  response.write   "条纪录!<br>您输入的字符串为"   &     "<font   color=red   size=3><b>"&qrystr   &   "</b></font><br>"    
  %>  
   
  <%  
  i=0  
  do   while   not   rs.eof  
  response.write   "<p>"  
  i=i+1  
  response.write   "<font   color=Fuchsia><b>"     &i   &   "&nbsp;</b></font>"    
  if   vartype(rs("doctitle"))=1   or   rs("doctitle")=""   then  
  response.write"<a   href=""   &   rs("vpath")   &   "">"   &   "<font   color=green   size=3>"   &   Server.HTMLEncode(rs("filename"))   &   "</font>   </a>"  
  else    
  response.write"<a   href=""   &   rs("vpath")   &   "">"   &   "<font   color=green   size=3>"   &   Server.HTMLEncode(rs("doctitle"))   &   "</font>   </a>"  
  end   if  
  if   vartype(rs("characterization"))=   8   and   rs("characterization")   <>   ""   then  
  response.write"<br><font   size=2   color="blue"><strong>摘要:-------------------------------------------------------------<br></strong></font>"   &   Server.HTMLEncode(rs("characterization"))  
  end   if  
    %><br>  
    <font   color="blue"><b>---------------------------------------------------------------------------</b></font><br>  
                          <i   class="recordstats"><a   href="<%=   rs("vpath")   %>"   target="_blank"   ><font   color="Red">http://10.10.14.104<%=   rs("vpath")   %></font></a><br>  
                          </i>  
    <%    
    rs.movenext  
    loop  
    end   if   %>Top

7 楼zcflion(吃大白菜的鸟--菜鸟)回复于 2002-03-14 18:45:02 得分 0

uupTop

8 楼totodo(土豆仙)回复于 2002-03-14 19:21:56 得分 0

加个分页?   那也不用这么劳师动众啊。。  
   
  听说你要用组件。。要不学习一下COM++   ,我是没信心了。。。  
   
  比较有难度。。本人转向JBean了Top

9 楼Alexander(药匣子)回复于 2002-03-14 20:00:32 得分 0

主要是想用规范些的代码  
  比如说iis4.0的代码  
  我装的是2000server没有啊  
  向大家求助Top

10 楼Alexander(药匣子)回复于 2002-03-15 12:50:12 得分 0

急啊Top

责任编辑: efish 参与评论 查找更多:
相关文章
PB6.5 打印问题? PB6.5 打印问题?
请问在Delphi怎样取得当前登录到Windows的用户名? 请问在Delphi怎样取得当前登录到Windows的用户名?
本人用JAVA开发了一套简单的数据操作软件,需要源代… 本人用JAVA开发了一套简单的数据操作软件,需要源代码的请留下email.
如何刷新FileListBox中的文件 如何刷新FileListBox中的文件
帮忙编个多线程的例子 帮忙编个多线程的例子
ADO select 返回系统变量值,如何取得该值? ADO select 返回系统变量值,如何取得该值?
关于 DirectShow 和 网络传输的问题,希望给点提示. 关于 DirectShow 和 网络传输的问题,希望给点提示.
从apache.org下载的httpd-2.0.32.zip怎么安装? 从apache.org下载的httpd-2.0.32.zip怎么安装?
我现在有一个项目,需要找几个人一起编程 我现在有一个项目,需要找几个人一起编程
关于实时曲线.... 关于实时曲线....
2秒记住本站域名

玩过泡泡龙吗?Readygo?Go! 再加上.Com.Cn的后缀,那就是大名小顶的ReadyGo.com.cn

分类导航
ReadyGo!技术成就梦想