<%@ page contentType="text/html" pageEncoding="UTF-8"%> <%@ page import="java.text.*" %> <%@ page import="java.util.*" %> <%@ page import="org.dom4j.*" %> <%@ page import="org.dom4j.io.SAXReader" %> <%@ page import="java.net.URL" %> <%@ page import="openv.base.*" %> <% String tmp = ""; String cfrom = Util.getStrDef(request.getParameter("cfrom"),"openvcom"); String sw_def = "list";//"view" String sw = Util.getStrDef(request.getParameter("sw"),sw_def).toLowerCase(); if(!java.util.regex.Pattern.matches("list|view",sw)){ sw = sw_def; } int perPage = 16; int pageNum= Util.strToInt(request.getParameter("page")); if(pageNum<1){ pageNum=1; } String q = Util.getStrDef(request.getParameter("q"),"dreall"); String myq = new String(q.getBytes("iso8859-1"),"UTF-8"); String cate = Util.getStrDef(request.getParameter("cate"),""); cate = new String(cate.getBytes("iso8859-1"),"UTF-8"); String cateQuery = ""; response.sendRedirect("http://www.openv.com/ls.php?q="+java.net.URLEncoder.encode(myq,"UTF-8")+"&c="+java.net.URLEncoder.encode(cate,"UTF-8")); if(true)return; if(cate.equals("新闻")){ cateQuery = "+AND+新闻:IndexCategory"; }else if(cate.equals("娱乐")){ cateQuery = "+AND+娱乐:IndexCategory"; }else if(cate.equals("体育")){ cateQuery = "+AND+体育:IndexCategory"; }else if(cate.equals("时尚")){ cateQuery = "+AND+时尚:IndexCategory"; }else if(cate.equals("影视")){ cateQuery = "+AND+影视:IndexCategory"; }else if(cate.equals("生活")){ cateQuery = "+AND+生活:IndexCategory"; }else{ cateQuery = ""; } String correctUrl = "http://10.1.11.42:7775/qu="+myq; String correctTxt=""; Document document = Util.parse(new java.net.URL(correctUrl)); Element root_new = document.getRootElement(); for(Iterator flashs = root_new.elementIterator("node");flashs.hasNext();){ Element flash = (Element)flashs.next(); String words = Util.getParamStr(flash.element("words").getTextTrim()); String search = Util.getParamStr(flash.element("search").getTextTrim()); String results = Util.getParamStr(flash.element("results").getTextTrim()); if(words.length()>0){ correctTxt = ""+words+""; } } q = " "+q; q = new String(q.getBytes("iso8859-1"),"UTF-8"); String db = Util.getStrDef(request.getParameter("db"),"video"); String s= Util.getStrDef(request.getParameter("s"),"r"); long projectId= Util.strToLong(request.getParameter("projectId")); long proId = projectId; //long start = (pageNum-1)*perPage+1; //long maxresults =pageNum*perPage; CookieBean theCookieBean = new CookieBean(); int totalhits = Util.strToInt(theCookieBean.getCookieValue(request,"totalhits")); Dre theDre = new Dre(); theDre.setDb(db); //theDre.setDahserver("10.1.12.123"); //解析xml 开始 ArrayList xmlList = null; int topRow = 0; if(pageNum == 1){ String zt_xml = getServletConfig().getServletContext().getRealPath("/")+"/service/zt_search_show.xml"; xmlList = theDre.queryXml(q,zt_xml); topRow = xmlList.size(); totalhits = totalhits+topRow; theCookieBean.addCookie(response,"topRow",String.valueOf(topRow)); }else{ topRow = Util.strToInt(theCookieBean.getCookieValue(request,"topRow")); } theDre.setTopRow(topRow); //解析xml 结束 //theDre.setTotalhits(totalhits); java.util.HashMap paraMap = new java.util.HashMap(); if("d".equals(s)){ paraMap.put("sort","date+Relevance"); }else{ paraMap.put("sort","Relevance+date"); } paraMap.put("cfrom",cfrom); //high light paraMap.put("summary","context"); paraMap.put("characters","68"); //if("list".equals(sw)){ paraMap.put("highlight","terms+summaryterms"); //} paraMap.put("StartTag",""); theDre.setParaMap(paraMap); ArrayList listArrayList = new ArrayList(); try{ listArrayList = theDre.queryAci("("+q+")"+cateQuery,pageNum,perPage); }catch(Exception ex){ out.println("###查询错误###"+ex.toString()); } totalhits = theDre.getTotalhits(); theCookieBean.addCookie(response,"totalhits",String.valueOf(totalhits)); //out.println("totalhits:"+totalhits); //out.println("totalhits:"+totalhits); //out.println("cmd:"+theDre.getCmd()); //out.println("response:"+theDre.getResponse()); q=q.replaceAll("dreall",""); // if no result redirect to no result page if(totalhits == 0){ response.sendRedirect("/noresult.jsp?q="+java.net.URLEncoder.encode(myq,"UTF-8")+"&db="+db+"&cate="+java.net.URLEncoder.encode(cate,"UTF-8")); } %> <%=q%> - OpenV - 专业中文电视及视频搜索引擎
关于<%if(!cate.equals("")){out.print(" "+cate+"类 ");}%><%=q%> 的搜索结果 共 <%=totalhits%> 条
<% java.util.HashMap mapTop = new java.util.HashMap(); mapTop.put("total",""+totalhits); mapTop.put("perpage",""+perPage); mapTop.put("nowindex",""+pageNum); mapTop.put("url",""+"ls.jsp?q="+java.net.URLEncoder.encode(q,"UTF-8")+"&db="+db+"&sw="+sw+"&s="+s+"&cate="+java.net.URLEncoder.encode(cate,"UTF-8")); mapTop.put("page_name","page"); mapTop.put("ajax",""); openv.base.Page thePageTop = new openv.base.Page(mapTop); thePageTop.setFormat_left(""); thePageTop.setFormat_right(""); out.print(thePageTop.show(7)); %>
<% if(sw.equals("list")){ %>
<% if(!correctTxt.equals("")){%>
您要找的是不是<%=correctTxt%>
<% } %> <% }else{ %>
<% if(!correctTxt.equals("")){%>
您要找的是不是<%=correctTxt%>
<% } %> <% } %>
    <% int i=0; //用于判断矩阵类型时换行 if(pageNum == 1){ if(xmlList != null){ for(int k=0;k
  • <%=title%>
    <%=Util.getStrDef(xmlVideo.getDrecontent(),"",36,"...",false)%>
    <%=xmlVideo.getPlaydate()%>
  • <% }else if(sw.equals("view")){ i++; %>
  • <%=title%>
    <%=xmlVideo.getPlaydate()%>
  • <% } } } } Video theVideo; if(listArrayList!=null){ for(Iterator it=listArrayList.iterator(); it.hasNext();) { i++; theVideo=(Video)it.next(); tmp = Util.getParamStr(theVideo.getTargetpage()); //--====== 凤凰网屏蔽该参数 ======--// if(tmp.toLowerCase().indexOf("phoenixtv.com")!=-1) tmp = ""; //String link = "player.jsp?targetpage="+Util.URLEncoderLoop(tmp,"utf-8",1)+"&ref="+theVideo.getDrereference()+"&db="+theVideo.getDredbname()+"&kw="+Util.URLEncoderLoop(q,"utf-8",1)+"&cfrom="+cfrom+(projectId>0?"&projectId="+projectId:""); String link = "player.jsp?ref="+theVideo.getDrereference()+"&db="+theVideo.getDredbname()+"&kw="+Util.URLEncoderLoop(q,"utf-8",1)+"&cfrom="+cfrom+(projectId>0?"&projectId="+projectId:"")+"&targetpage="+Util.URLEncoderLoop(tmp,"utf-8",1); String title = theVideo.getDretitle(); title = replaceHTMLCode(title).replaceAll("'","'"); if(sw.equals("list")){ %>
  • <%=theVideo.getDretitle()%>
    <%=theVideo.getSummary()%>...
    <%=Util.getStrDef(theVideo.getChinesechannelname(),"",9,"...",false)%> <%=theVideo.getPlaydate()%>
  • <% } else if(sw.equals("view")){ %>
  • <%=theVideo.getDretitle()%>
    <%=openv.base.Util.getStrDef(theVideo.getChinesechannelname(),"",4,"",false)%>
    <%=theVideo.getPlaydate()%>
  • <% } } } %>
热门搜索
    <% incPath = "inc/index_hotkeyword.jsp?target=ls"; %>
精彩推荐
<% java.util.HashMap map = new java.util.HashMap(); map.put("total",""+totalhits); map.put("perpage",""+perPage); map.put("nowindex",""+pageNum); map.put("url",""+"ls.jsp?q="+java.net.URLEncoder.encode(q,"UTF-8")+"&db="+db+"&sw="+sw+"&s="+s+"&cate="+java.net.URLEncoder.encode(cate,"UTF-8")); map.put("page_name","page"); map.put("ajax",""); openv.base.Page thePage = new openv.base.Page(map); thePage.setFormat_left(""); thePage.setFormat_right(""); out.print(thePage.show(8)); %>
<% if(!q.equals("")){ %> <% } %>
<% //主动内存回收 theDre = null; listArrayList = null; paraMap = null; theCookieBean = null; thePage = null; %> <%! private String replaceHTMLCode(String s){ try{ s = s.replaceAll("(?s)<.*?>",""); }catch(Exception e){ } return s; } %>