Zend framework Zend_-Lucene错误
我对使用Zend框架是个新手。我想用Zend_Lucene在我的网站上实现一个小型图书引擎。我下载了完整的软件包并将其包含在我的Netbeans 7中,一切正常,然后,我阅读了Zend_Lucene官方网站的入门教程,我可以进行索引,但有一些错误: 这是我的密码:Zend framework Zend_-Lucene错误,zend-framework,lucene,zend-search-lucene,Zend Framework,Lucene,Zend Search Lucene,我对使用Zend框架是个新手。我想用Zend_Lucene在我的网站上实现一个小型图书引擎。我下载了完整的软件包并将其包含在我的Netbeans 7中,一切正常,然后,我阅读了Zend_Lucene官方网站的入门教程,我可以进行索引,但有一些错误: 这是我的密码: require_once('ZendFramework-1.11.7/library/Zend/Search/Lucene.php'); $indexPath = 'C:\wamp\www\witswork\Documents'; $
require_once('ZendFramework-1.11.7/library/Zend/Search/Lucene.php');
$indexPath = 'C:\wamp\www\witswork\Documents';
$index = Zend_Search_Lucene::create($indexPath);
$index = Zend_Search_Lucene::open($indexPath);
$query = new Zend_Search_Lucene_Search_Query_MultiTerm();
$doc = new Zend_Search_Lucene_Document();
$doc->addField(Zend_Search_Lucene_Field::UnIndexed('url', "Plan.docx"));
$doc->addField(Zend_Search_Lucene_Field::Text('title', "Plan"));
$hits = $index->find($query);
$index->addDocument($doc);
$index->commit();
已创建以下文件:
下面是错误:_0.cfs、segments_2、optimization.lock.file、read.lock.file、read-lock-processing.lock.file、write.lock.file和segments.gen
这是运行我的代码并创建索引器后出现的错误:
Warning: require_once(Zend/Search/Lucene/Storage/File/Filesystem.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\witswork\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 349
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Search/Lucene/Storage/File/Filesystem.php' (include_path='.;C:\php5\pear;ZendFramework-1.11.7/library/Zend') in C:\wamp\www\witswork\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 349
我读到这需要将库包含到我的include_路径中,我在我的Netbeans周围溜达了一圈,我想我得到了它,这里是一个屏幕截图:
请支持我的问题,我需要它的毕业项目!
提前谢谢!
问候 请勿在Netbeans中使用此“全局包含路径”。在起始php文件(index.php)中使用set_include_path()函数 我只是遇到了一个类似的问题,不知道为什么Zend_Lucene不起作用。总是能想到
Warning: require_once(Zend/Search/Lucene/Storage/File/Filesystem.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\witswork\Zend\Search\Lucene\Storage\Directory\Filesystem.php on line 349
问题是,我的include路径(set_include_path
)导致了这个问题,因为我只提供了到Zend框架的相对链接
我通过指定Zend Framework库的绝对路径解决了这个问题——因此,我查看Lucene是否运行的最小代码示例如下所示:
<?php
$zendPath = realpath('../_lib/ZendFramework-1.11.11/library/');
set_include_path($zendPath.PATH_SEPARATOR.get_include_path());
include 'Zend/Loader/Autoloader.php';
Zend_Loader_Autoloader::getInstance();
$index = Zend_Search_Lucene::create('test');
?>
你的意思是说:设置包含路径(dirname(uuuu FILE_uuuu)。”;获取包含路径();需要一次'Zend/Loader.php'代码>在my index.php上?我做了,但没有改变。请注意,我的项目是一个标准项目,我没有通过创建项目的向导包含Zend。我在开始脚本中总是这样做:define('ROOT_PATH',realpath(dirname('u_文件__)。'/…);定义('LIB_PATH',ROOT_PATH./LIB/');set_include_path(LIB_path.path_SEPARATOR.get_include_path());//设置autoloader require_once“Zend/Loader/autoloader.php”$autoloader=Zend_Loader_autoloader::getInstance()$自动加载器->寄存器空间('Zend_')代码>