gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 13:29:22 25 4
gpt4 key购买 nike

在我的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

包含从Wikipedia复制的文本数组,并且我遇到字符错误-(不是-)和ö,我因此而出错(我相信)。我在 Lucene foreign chars problem遇到了类似的问题,它没有解释在哪里做什么。如果我知道在哪里做什么以及一点点的解释,我将不胜感激。

更新:: iconv
 iconv support          enabled
iconv implementation glibc
iconv library version 2.12.1

最佳答案

尝试将其添加到您的 bootstrap 中:

Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
Zend_Search_Lucene_Analysis_Analyzer::setDefault(
new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive ()
);

关于zend-framework - 用于lucene文本搜索的无效字符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4723135/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com