阅读背景:

如何在数据库中存储lucene索引?

来源:互联网 

This is my sample code:

这是我的示例代码:

MysqlDataSource dataSource = new MysqlDataSource();

dataSource.setUser("root");
dataSource.setPassword("ncl");
dataSource.setDatabaseName("userdb");
dataSource.setEmulateLocators(true); //This is important because we are dealing with a blob type data field
try{    
    JdbcDirectory jdbcDir = new JdbcDirectory(dataSource, new MySQLDialect(), "tttable");
    StandardAnalyzer analyzer = new StandardAnalyzer();
    IndexWriter writer = new IndexWriter(jdbcDir, analyzer,false);
    writer.optimize();
    writer.close();
}catch(Exception e){
System.out.print(e);
}
MysqlData



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: