1. <small id='xlwwt'></small><noframes id='xlwwt'>

        <bdo id='xlwwt'></bdo><ul id='xlwwt'></ul>
      <i id='xlwwt'><tr id='xlwwt'><dt id='xlwwt'><q id='xlwwt'><span id='xlwwt'><b id='xlwwt'><form id='xlwwt'><ins id='xlwwt'></ins><ul id='xlwwt'></ul><sub id='xlwwt'></sub></form><legend id='xlwwt'></legend><bdo id='xlwwt'><pre id='xlwwt'><center id='xlwwt'></center></pre></bdo></b><th id='xlwwt'></th></span></q></dt></tr></i><div id='xlwwt'><tfoot id='xlwwt'></tfoot><dl id='xlwwt'><fieldset id='xlwwt'></fieldset></dl></div>

      <legend id='xlwwt'><style id='xlwwt'><dir id='xlwwt'><q id='xlwwt'></q></dir></style></legend>

      <tfoot id='xlwwt'></tfoot>

    2. 未找到“ZendSearchLuceneLucene"类 ZendFramework2

      时间:2024-05-10
      <i id='flR3q'><tr id='flR3q'><dt id='flR3q'><q id='flR3q'><span id='flR3q'><b id='flR3q'><form id='flR3q'><ins id='flR3q'></ins><ul id='flR3q'></ul><sub id='flR3q'></sub></form><legend id='flR3q'></legend><bdo id='flR3q'><pre id='flR3q'><center id='flR3q'></center></pre></bdo></b><th id='flR3q'></th></span></q></dt></tr></i><div id='flR3q'><tfoot id='flR3q'></tfoot><dl id='flR3q'><fieldset id='flR3q'></fieldset></dl></div>

        <tbody id='flR3q'></tbody>

      1. <tfoot id='flR3q'></tfoot>
        <legend id='flR3q'><style id='flR3q'><dir id='flR3q'><q id='flR3q'></q></dir></style></legend>

          <small id='flR3q'></small><noframes id='flR3q'>

            <bdo id='flR3q'></bdo><ul id='flR3q'></ul>

              • 本文介绍了未找到“ZendSearchLuceneLucene"类 ZendFramework2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我已经使用这些命令安装了 ZendSearch 和 composer:

                I've installed ZendSearch with composer using these commands:

                $ cd /var/www/CommunicationApp/vendor/
                $ git clone https://github.com/zendframework/ZendSearch.git
                ZendSearch
                $ cd ZendSearch/
                $ curl -s https://getcomposer.org/installer | php
                $ php composer.phar install
                

                我已经根据 GITHUB 安装了 Zendskeleton所以,我不知道我在这里缺少什么.

                And I've installed Zendskeleton according to GITHUB So, I don't know What I'm missing here.

                比,在同一个 书,它教如何使用 ZendSearch,但我没有得到相同的结果,而是我得到一个致命错误:致命错误:在/var/www 中找不到类'ZendSearchLuceneLucene'/CommunicationApp/module/Users/src/Users/Controller/SearchController.php 第 107 行

                Than, in the same book, it teaches how to use ZendSearch, but I'm not getting the same results, instead I'm getting a Fatal error: Fatal error: Class 'ZendSearchLuceneLucene' not found in /var/www/CommunicationApp/module/Users/src/Users/Controller/SearchController.php on line 107

                <?php
                namespace UsersController;
                
                use ZendMvcControllerAbstractActionController;
                use ZendViewModelViewModel;
                
                use ZendHttpHeaders;
                
                use ZendAuthenticationAuthenticationService;
                use ZendAuthenticationAdapterDbTable as DbTableAuthAdapter;
                
                use UsersFormRegisterForm;
                use UsersFormRegisterFilter;
                
                use UsersModelUser;
                use UsersModelUserTable;
                use UsersModelUpload;
                
                use UsersModelImageUpload;
                use UsersModelImageUploadTable;
                
                use ZendSearchLucene;
                use ZendSearchLuceneDocument;
                use ZendSearchLuceneIndex;
                
                class SearchController extends AbstractActionController
                {
                    protected $storage;
                    protected $authservice;
                
                    public function getAuthService()
                    {
                        if (! $this->authservice) {
                            $this->authservice = $this->getServiceLocator()->get('AuthService');
                        }
                        return $this->authservice;
                    }
                
                    public function getIndexLocation()
                    {
                        // Fetch Configuration from Module Config
                        $config  = $this->getServiceLocator()->get('config');
                        if ($config instanceof Traversable) {
                            $config = ArrayUtils::iteratorToArray($config);
                        }
                        if (!empty($config['module_config']['search_index'])) {
                            return $config['module_config']['search_index'];
                        } else {
                            return FALSE;
                        }
                    }
                
                    public function getFileUploadLocation()
                    {
                        // Fetch Configuration from Module Config
                        $config  = $this->getServiceLocator()->get('config');
                        if ($config instanceof Traversable) {
                            $config = ArrayUtils::iteratorToArray($config);
                        }
                        if (!empty($config['module_config']['upload_location'])) {
                            return $config['module_config']['upload_location'];
                        } else {
                            return FALSE;
                        }
                    }   
                
                    public function indexAction()
                    {
                        $request = $this->getRequest();
                        if ($request->isPost()) {
                            $queryText = $request->getPost()->get('query');
                            $searchIndexLocation = $this->getIndexLocation();
                            $index = LuceneLucene::open($searchIndexLocation);
                            $searchResults = $index->find($queryText);
                        }
                
                        // prepare search form
                        $form  = new endFormForm();
                        $form->add(array(
                            'name' => 'query',
                            'attributes' => array(
                                'type'  => 'text',
                                'id' => 'queryText',
                                'required' => 'required'
                            ),
                            'options' => array(
                                'label' => 'Search String',
                            ),
                        ));
                        $form->add(array(
                            'name' => 'submit',
                            'attributes' => array(
                                'type'  => 'submit',
                                'value' => 'Search', 
                                'style' => "margin-bottom: 8px; height: 27px;"
                            ),
                        ));
                
                        $viewModel  = new ViewModel(array('form' => $form, 'searchResults' => $searchResults));
                        return $viewModel;
                    }
                
                
                    public function generateIndexAction()
                    {
                        $searchIndexLocation = $this->getIndexLocation();
                        $index = LuceneLucene::create($searchIndexLocation);
                
                        $userTable = $this->getServiceLocator()->get('UserTable');
                        $uploadTable = $this->getServiceLocator()->get('UploadTable');
                        $allUploads = $uploadTable->fetchAll();  
                        foreach($allUploads as $fileUpload) {
                            //
                            $uploadOwner = $userTable->getUser($fileUpload->user_id);
                
                            // id field
                            $fileUploadId= DocumentField::unIndexed('upload_id', $fileUpload->id);
                            // label field
                            $label = DocumentField::Text('label', $fileUpload->label);
                            // owner field          
                            $owner = DocumentField::Text('owner', $uploadOwner->name);
                
                
                            if (substr_compare($fileUpload->filename, ".xlsx", strlen($fileUpload->filename)-strlen(".xlsx"), strlen(".xlsx")) === 0) {
                                // index excel sheet
                                $uploadPath    = $this->getFileUploadLocation();
                                $indexDoc = LuceneDocumentXlsx::loadXlsxFile($uploadPath ."/" . $fileUpload->filename);
                            } else if (substr_compare($fileUpload->filename, ".docx", strlen($fileUpload->filename)-strlen(".docx"), strlen(".docx")) === 0) {
                                // index word doc
                                $uploadPath    = $this->getFileUploadLocation();
                                $indexDoc = LuceneDocumentDocx::loadDocxFile($uploadPath ."/" . $fileUpload->filename);
                            } else {
                                $indexDoc = new LuceneDocument();
                            }
                            $indexDoc->addField($label);
                            $indexDoc->addField($owner);
                            $indexDoc->addField($fileUploadId);
                            $index->addDocument($indexDoc);
                        }
                        $index->commit();
                    }
                
                }
                

                推荐答案

                这本书给了你奇怪的指示,因为它说 Zend Search 不能通过安装.作曲家,但这不再是这种情况并不完全正确.修复:

                The book is giving you weird instructions because it says Zend Search cannot be installed via. Composer, but this is no longer the case not quite true. To fix:

                1. 删除您的 vendor 文件夹
                2. 编辑您的 composer.json 并将 zendframework/zendsearch 添加到要求部分
                3. 运行 php composer.phar install 安装所有包(包括 Zend Search)
                1. Delete your vendor folder
                2. Edit your composer.json and add zendframework/zendsearch to the require section
                3. Run php composer.phar install to install all packages (including Zend Search)

                那么一切都应该正常工作.

                Then everything should be working.

                编辑:好的,由于某种原因,这个包没有在 packagist 上列出.您还需要将 repo URL 添加到您的 composer.json:

                Edit: okay, for some reason this package isn't listed on packagist. You'll also need to add the repo URL to your composer.json:

                "repositories": [
                    {
                        "type": "vcs",
                        "url": "https://github.com/zendframework/ZendSearch"
                    }
                ],
                

                然后再试一次.

                这篇关于未找到“ZendSearchLuceneLucene"类 ZendFramework2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:在 MySQL 全文搜索中处理拼写错误的最佳方法 下一篇:Zend Lucene 和 Java Lucene 的性能比较

                相关文章

              • <legend id='kC088'><style id='kC088'><dir id='kC088'><q id='kC088'></q></dir></style></legend>

                  <i id='kC088'><tr id='kC088'><dt id='kC088'><q id='kC088'><span id='kC088'><b id='kC088'><form id='kC088'><ins id='kC088'></ins><ul id='kC088'></ul><sub id='kC088'></sub></form><legend id='kC088'></legend><bdo id='kC088'><pre id='kC088'><center id='kC088'></center></pre></bdo></b><th id='kC088'></th></span></q></dt></tr></i><div id='kC088'><tfoot id='kC088'></tfoot><dl id='kC088'><fieldset id='kC088'></fieldset></dl></div>
                1. <small id='kC088'></small><noframes id='kC088'>

                2. <tfoot id='kC088'></tfoot>

                      <bdo id='kC088'></bdo><ul id='kC088'></ul>