会用zend_searck_lucene的哥们进来救命

huaihuajio 2009-05-02 03:47:57
怎么才能让这玩意支持中文搜索啊
我试了下,英文是完全没问题的,可是中文怎么都不行
就搜索完全精确地关键字都不行。
数据库,表我都设成UTF-8了啊
$index=new Zend_Search_Lucene('index',true);
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Phpbean_Lucene_Analyzer());
$sql='select c_id,c_title from t_title';
$link=new conn();
$conn=$link->connect();
$r=$conn->query($sql);
$r->setFetchMode(PDO::FETCH_ASSOC);
while($row=$r->fetch())
{
$url='http://localhost/detail.php?pid='.$row['c_id'];
$title=$row['c_title'];
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', $url,'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('title', $title,'utf-8'));
$doc->addField(Zend_Search_Lucene_Field::Text('contents', $title,'utf-8'));
$index->addDocument($doc);
$index->commit();
}
?>

这是我建立索引时的源代码,是不是有什么错误的地方捏?
require_once('ZendFramework-1.0.0/library/Zend/Search/Lucene.php');
require_once('conn.inc.php');
require_once('zend_chinese_seperate.class.php');
$index = new Zend_Search_Lucene('index');
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Phpbean_Lucene_Analyzer());
$str = <<<EOT
<form method=get action="">
<input type="text" name="keywords"><input type="submit">
</form>
EOT;
这是搜索时的一部分源代码,后面的都无关紧要了。应该没错的地方吧?

...全文
104 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
huaihuajio 2009-05-04
  • 打赏
  • 举报
回复
我再顶,顶到有人回答为止~~
huaihuajio 2009-05-02
  • 打赏
  • 举报
回复
顶~~
huaihuajio 2009-05-02
  • 打赏
  • 举报
回复
救命救命救命~~~

4,250

社区成员

发帖
与我相关
我的任务
社区描述
国内外优秀PHP框架讨论学习
社区管理员
  • Framework
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧