zend-framework – lucene文本搜索的无效字符

前端之家收集整理的这篇文章主要介绍了zend-framework – lucene文本搜索的无效字符前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
在我的IndexController上我有
public function buildAction()
    {

    $index = Zend_Search_Lucene::create(APPLICATION_PATH . '/indexes');     

    foreach ($this->pages as $p) {
        $doc = new Zend_Search_Lucene_Document();

        $doc->addField(Zend_Search_Lucene_Field::unIndexed('page_id',$p['page_id']));

        $doc->addField(Zend_Search_Lucene_Field::text('page_name',$p['page_name']));

        $doc->addField(Zend_Search_Lucene_Field::text('page_headline',$p['page_headline']));

        $doc->addField(Zend_Search_Lucene_Field::text('page_content',$p['page_content']));


        $index->addDocument($doc);
    }
    $index->optimize();
    $this->view->indexSize = $index->numDocs();
    }

我收到了错误

[Tue Jan 18 16:23:32 2011] [error] [client 127.0.0.1] PHP Notice:  iconv(): Detected an illegal character in input string in /usr/share/PHP/libzend-framework-PHP/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.PHP on line 58
[Tue Jan 18 16:23:32 2011] [error] [client 127.0.0.1] PHP Notice:  iconv(): Detected an illegal character in input string in /usr/share/PHP/libzend-framework-PHP/Zend/Search/Lucene/Field.PHP on line 222
[Tue Jan 18 16:23:32 2011] [error] [client 127.0.0.1] PHP Notice:  iconv(): Detected an illegal character in input string in /usr/share/PHP/libzend-framework-PHP/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.PHP on line 58
[Tue Jan 18 16:23:32 2011] [error] [client 127.0.0.1] PHP Notice:  iconv(): Detected an illegal character in input string in /usr/share/PHP/libzend-framework-PHP/Zend/Search/Lucene/Field.PHP on line 222
[Tue Jan 18 16:23:32 2011] [error] [client 127.0.0.1] PHP Notice:  iconv(): Detected an illegal character in input string in /usr/share/PHP/libzend-framework-PHP/Zend/Search/Lucene/Analysis/Analyzer/Common/Text.PHP on line 58
[Tue Jan 18 16:23:32 2011] [error] [client 127.0.0.1] PHP Notice:  iconv(): Detected an illegal character in input string in /usr/share/PHP/libzend-framework-PHP/Zend/Search/Lucene/Field.PHP on line 222

和变量

$this->pages

包含从维基百科复制的文本数组,我收到错误的字符 – (不是 – )和ö我得到错误(我相信).我在Lucene foreign chars problem得到了类似的相关问题,但没有解释在哪里做什么.如果我知道该做什么以及一点点解释,我将不胜感激

最新通报::的iconv

iconv support          enabled
 iconv implementation   glibc
 iconv library version  2.12.1
尝试将此添加到您的引导程序:
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
Zend_Search_Lucene_Analysis_Analyzer::setDefault(
    new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive ()
);
原文链接:/php/133669.html

猜你在找的PHP相关文章