CakePHP 与 Lucene
我正在尝试使用 cakephp 实现 Lucene 并遵循本指南 http://jamienay.com/2010/01/zend_search_lucene-datasource-for- cakephp/
我收到此错误
ConnectionManager::loadDataSource - 无法导入 DataSource 类 .ZendSearchLuceneSource
我已将供应商文件放置在 app/vendors/Zend/ 中
将此添加到 bootstrap.php
ini_set('include_path', ini_get('include_path') . ':' . CAKE_CORE_INCLUDE_PATH . DS . '/vendors');
/**
* AutoLoading Zend Vendor Files
*/
function __autoload($path) {
if(substr($path, 0, 5) == 'Zend_') {
include str_replace('_', '/', $path) . '.php';
}
return $path;
}
数据库配置
var $zendSearchLucene = array(
'datasource' => 'ZendSearchLucene',
'indexFile' => 'lucene', // stored in the cache dir.
'driver' => '',
'source' => 'search_indices'
);
将其添加到创建的 中一个名为 search.php 的模型
<?php
class Search extends AppModel {
var $useDbConfig = 'zendSearchLucene';
}
?>
现在我也创建了一个名为 search 的控制器,
<?php
class SearchController extends AppController {
var $name = 'Search';
function index(){
}
}
?>
当我访问 site/search 时,我收到了该错误。
I am trying to implement Lucene with cakephp and following this guide
http://jamienay.com/2010/01/zend_search_lucene-datasource-for-cakephp/
Am getting this error
ConnectionManager::loadDataSource - Unable to import DataSource class .ZendSearchLuceneSource
i have placed the Vendor files in app/vendors/Zend/
Added this in the bootstrap.php
ini_set('include_path', ini_get('include_path') . ':' . CAKE_CORE_INCLUDE_PATH . DS . '/vendors');
/**
* AutoLoading Zend Vendor Files
*/
function __autoload($path) {
if(substr($path, 0, 5) == 'Zend_') {
include str_replace('_', '/', $path) . '.php';
}
return $path;
}
added this to the Database Config
var $zendSearchLucene = array(
'datasource' => 'ZendSearchLucene',
'indexFile' => 'lucene', // stored in the cache dir.
'driver' => '',
'source' => 'search_indices'
);
Add created a model called search.php
<?php
class Search extends AppModel {
var $useDbConfig = 'zendSearchLucene';
}
?>
Right now i have created a controller called search too like this
<?php
class SearchController extends AppController {
var $name = 'Search';
function index(){
}
}
?>
when i visit site/search am getting that error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不确定这是否仍然与您相关,但我刚刚开始使用相同的数据源并遇到了相同的问题。我更新了 Cake 1.3 的数据源,它现在应该可以工作了。
看看我在 Github 上的项目分支:
https://github.com/deceze/zend_search_lucene_source
如果您发现任何问题,请为他们开放票证。我会看看是否能抽出时间来修复它们。数据源是一个很好的基础,但可能需要一些更新和扩展。
Not sure if this is still relevant to you, but I have just begun using the same datasource and came across the same issues. I updated the datasource for Cake 1.3 and it should work now.
Have a look at my fork of the project at Github:
https://github.com/deceze/zend_search_lucene_source
If you find any problems with it, please open tickets for them. I'll see if I can get around to fixing them. The datasource is a good basis, but may need some updating and extension.