【问题标题】:CakePHP with LuceneCakePHP 与 Lucene
【发布时间】:2010-11-07 18:47:10
【问题描述】:

我正在尝试使用 cakephp 实现 Lucene 并遵循本指南 http://jamienay.com/2010/01/zend_search_lucene-datasource-for-cakephp/

遇到这个错误

ConnectionManager::loadDataSource - 无法导入 DataSource 类 .ZendSearchLuceneSource

我已将 Vendor 文件放在 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(){

    }


}
?>

当我访问网站/搜索时出现该错误。

【问题讨论】:

  • 已经这样做了,也将 zend_search_lucene.php 复制到模型/数据源

标签: cakephp lucene cakephp-1.3 zend-search-lucene zend-lucene


【解决方案1】:

不确定这是否仍然与您相关,但我刚刚开始使用相同的数据源并遇到了相同的问题。我更新了 Cake 1.3 的数据源,它现在应该可以工作了。

看看我在 Github 上的项目分支:
https://github.com/deceze/zend_search_lucene_source

如果您发现任何问题,请为他们open tickets。我会看看我是否可以解决它们。数据源是一个很好的基础,但可能需要一些更新和扩展。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-01
    • 2013-08-24
    • 2011-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-11
    相关资源
    最近更新 更多