日期:2014-05-16  浏览次数:20778 次

站内搜索关键词排序与英文字母大小写不区分问题
输入多个关键词,搜索结果按关键词出现个数或者次数多的排前面;和输入英文字母不管大写小写都高亮。
需要添加哪些代码才能实现呢?
请各位指教指教,感谢!虽然分不多,但这是我目前全部身家了。

<!--#include file="utf-8.asp"-->
<!--#include file="conn.asp"-->
<!--#include file="config.asp" -->
<!--#include file="page.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=request("key")%></title>
<meta name="description" content="<%=config("description")%>" />
<meta name="keywords" content="<%=config("keywords")%>" />
<link href="images/style.css" type="text/css" rel="stylesheet" />
</head>
<body bgcolor="<%=config("bg")%>">
<!--#include file="header.asp" -->
<!--#include file="search_so.asp" -->
<table width="920" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
      <tr>
        <td colspan="2"><table width="100%" border="0" cellpadding="6" cellspacing="1" bgcolor="#CCCCCC">
          <tr>
            <td bgcolor="#EBEBEB"><table width="98%" border="0" cellpadding="0" cellspacing="2">
                <tr>
        <td>&nbsp;<b>关于“<font color="#FF0000"><%=request("key")%></font>”的搜索结果:</b></td>
                  <td><div align="right"></div></td>
                </tr>
            </table></td>
          </tr>
            <td bgcolor="#FFFFFF">
</body>
</html>
<%  
key=Trim(Request("key"))
 if key="" then
 Response.Write("<script>alert('请输入关键词!');history.back();</script>")
 Response.End()
 end if
key=replace(key," ",",")
keyArr=split(key,",")
sql="select * from [news] where 1=0"
for i=0 to ubound(keyArr)
sql=sql&" or title like '%"&keyArr(i)&"%'"
next
sql=sql&" order by id desc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1 
if rs.eof then
response.Write "&nbsp;暂无内容!"
else
rs.PageSize =20 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount 
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif  page>maxpage then
page=maxpage
en