php zend search lucene 优化
来源:百度知道 编辑:UC知道 时间:2024/08/31 01:23:08
我的zend search lucene 代码你看看对你有帮助没???
function indexAction() {
$album = new Guestbook();
$view=new Zend_View();
$db = $album ->getAdapter();
$select =$db->query('SELECT * FROM st');
while($row = $select->fetch()) {
$user=$row['username'];
$pass=$row['password'];
$index = new Zend_Search_Lucene('index');
$doc = new Zend_Search_Lucene_Document();
// Store document URL to identify it in search result.
$doc->addField(Zend_Search_Lucene_Field::Text('username',$user));
// Index document content
$doc->addField(Zend_Search_Lucene_Field::Text('password',$pass));
// Add document to the index.
$index->addDocument($doc);
// Write changes to the index.
$index->commit();
//////
}
你这个貌似没有优化的部分么,最近我也在烦恼这个问题,zend lucene文档里面只有三个优化选项
1. MaxBufferedDocs auto-optimization op