Z
zhanghb
Unregistered / Unconfirmed
GUEST, unregistred user!
一个indexwiter类,在命令行下,测试程序运行正常,对2460条记录的数据库的标题字段
做索引,用时15秒,下面是程序:
import cn.net.cetin.analysis.cn.ChineseAnalyzer;
import cn.net.cetin.index.IndexWriter;
import java.util.Date;
class IndexDB {
public static void main(String[] args) {
try {
Date start = new Date();
short[] fieldNos={(short)4,(short)5};
byte[] indexModes={(byte)0,(byte)0};
IndexWriter writer = new IndexWriter((short)2, fieldNos,indexModes,new ChineseAnalyzer());
writer.index();
writer.close();
Date end = new Date();
System.out.print(end.
getTime() - start.getTime());
System.out.println(" total milliseconds");
} catch (Exception e) {
e.printStackTrace();
System.out.println(" caught a " + e.getClass() +
"/n with message: " + e.getMessage());
}
}
}
写到jsp页面里是这样的:编译能通过,就是页面里只显示出来了背景图片,没结果!
<%@ page language = "java" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "java.io.*" %>
<%@ page import = "java.lang.*" %>
<%@ page import = "java.util.Date" %>
<%@ page import = "cn.net.cetin.index.* "%>
<%@ page import = "cn.net.cetin.dao.* "%>
<%@ page import = "cn.net.cetin.analysis.cn.* "%>
<%@ page import = "cn.net.cetin.analysis.* "%>
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>Indexresult</title>
</head>
<body aLink=#663333 background=images/back3.gif leftMargin=4 link=#663333 topMargin=4 vLink=#663333>
<jsp:include page="header.jsp" flush="true" />
<p>数据管理&gt;&gt;数据索引管理&gt;&gt;索引结果</p>
<%
short[] fieldNos={(short)4,(short)5};
byte[] indexModes={(byte)0,(byte)0};
Date start=null,end=null;
try{
start = new Date();
IndexWriter writer = new IndexWriter((short)2, fieldNos,indexModes,new ChineseAnalyzer());
writer.index();
writer.close();
end = new Date();
}catch(Exception e){
String s=e.toString();
out.println(s);
}
out.println(" 索引成功!共历时:");
out.print(end.
getTime() - start.getTime());
out.println(" 毫秒");
%> </p>
<jsp:include page="footer.html" flush="true" />
</body>
</html>
请教各路神仙!
做索引,用时15秒,下面是程序:
import cn.net.cetin.analysis.cn.ChineseAnalyzer;
import cn.net.cetin.index.IndexWriter;
import java.util.Date;
class IndexDB {
public static void main(String[] args) {
try {
Date start = new Date();
short[] fieldNos={(short)4,(short)5};
byte[] indexModes={(byte)0,(byte)0};
IndexWriter writer = new IndexWriter((short)2, fieldNos,indexModes,new ChineseAnalyzer());
writer.index();
writer.close();
Date end = new Date();
System.out.print(end.
getTime() - start.getTime());
System.out.println(" total milliseconds");
} catch (Exception e) {
e.printStackTrace();
System.out.println(" caught a " + e.getClass() +
"/n with message: " + e.getMessage());
}
}
}
写到jsp页面里是这样的:编译能通过,就是页面里只显示出来了背景图片,没结果!
<%@ page language = "java" %>
<%@ page import = "java.sql.*" %>
<%@ page import = "java.io.*" %>
<%@ page import = "java.lang.*" %>
<%@ page import = "java.util.Date" %>
<%@ page import = "cn.net.cetin.index.* "%>
<%@ page import = "cn.net.cetin.dao.* "%>
<%@ page import = "cn.net.cetin.analysis.cn.* "%>
<%@ page import = "cn.net.cetin.analysis.* "%>
<%@ page contentType="text/html;charset=gb2312"%>
<html>
<head>
<title>Indexresult</title>
</head>
<body aLink=#663333 background=images/back3.gif leftMargin=4 link=#663333 topMargin=4 vLink=#663333>
<jsp:include page="header.jsp" flush="true" />
<p>数据管理&gt;&gt;数据索引管理&gt;&gt;索引结果</p>
<%
short[] fieldNos={(short)4,(short)5};
byte[] indexModes={(byte)0,(byte)0};
Date start=null,end=null;
try{
start = new Date();
IndexWriter writer = new IndexWriter((short)2, fieldNos,indexModes,new ChineseAnalyzer());
writer.index();
writer.close();
end = new Date();
}catch(Exception e){
String s=e.toString();
out.println(s);
}
out.println(" 索引成功!共历时:");
out.print(end.
getTime() - start.getTime());
out.println(" 毫秒");
%> </p>
<jsp:include page="footer.html" flush="true" />
</body>
</html>
请教各路神仙!