I使用字符集utf 8,它是错误的:
Notice: Trying to get property of non-object in C:'wamp'www'zend-search-lucene'indexing.php on line 27
这是php:代码
<?php
require_once 'Zend/Search/Lucene.php';
$arr_data = array(0 => array( "products" => "Google suggest : pick right search keyword"),
1 => array("products" => "zend framework tutorial | part 9 Zend Auth"));
$lucene_index_path = 'data/';
$index = new Zend_Search_Lucene($lucene_index_path, true);
Zend_Search_Lucene_Analysis_Analyzer::setDefault(new Zend_Search_Lucene_Analysis_Analyzer_Common_Utf8_CaseInsensitive());
foreach($arr_data as $test) {
//create an cache index doc
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::Text('products', $test->products, 'UTF-8')); **//LINE 27**
$index->addDocument($doc);
}
$index->commit();
$index->optimize();
$doc->addField(Zend_Search_Lucene_Field::Text('products', $test['products'], 'UTF-8'));
将$test->products
更改为$test['products']