Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

No indexing and "Cannot redeclare class Zend_Search_Lucene_Analysis_Analyzer" #17

Closed
JohnnyricoMC opened this issue Feb 14, 2014 · 11 comments

Comments

@JohnnyricoMC
Copy link

Expected behaviour

Entering a string in the search bar returns filenames and files containing the provided string. Index files are created in /var/www/owncloud/data/username/lucene_index/

Actual behaviour

In the file list only files containing the string in their filename change background like when users hover the cursor over the file's row. No search results appear. When Full Text Search is disables filenames get returned. No index files are created in /var/www/owncloud/data/username/lucene_index/, only a read.lock.file exists. No records exist in the oc_lucene_status table.

Steps to reproduce

Created multiple user accounts, toggled Full Text search on and off. Entered strings appearing in stored text files into search box as well as strings matching filename.

Server configuration:

  • OS: Debian 7 "Wheezy"
  • Web Server: Apache 2.2.22
  • Database: MySQL 5.5.31
  • PHP version: PHP 5.4.4-14
  • Owncloud Version: 6.0.1
  • Updated from an older owncloud or fresh install: yes, from Owncloud 5.0.14
  • config/config.php:
<?php
$CONFIG = array (
  'instanceid' => '50eae36e2fdff',
  'passwordsalt' => 'OMITTED',
  'datadirectory' => '/var/www/owncloud/data',
  'dbtype' => 'mysql',
  'version' => '6.0.0.16',
  'dbname' => 'owncloud_mysql',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'owncloud_mysql',
  'dbpassword' => 'OMITTED',
  'installed' => true,

  'ldapIgnoreNamingRules' => false,
  'loglevel' => '0',
  'maintenance' => false,
  'theme' => '',
  'forcessl' => true,
  'maxZipInputSize' => 838860800,
  'allowZipDownload' => true,
);
  • Are you using external storage, if yes which one: no
  • All files and folders in /var/www/owncloud are currently owned by www-data

Client configuration

Browsers: Mozilla Firefox, Google Chrome, Safari (Xubuntu and Mac OS X), untested on Windows

Activated apps:

  • Deleted files 0.4
  • Encryption 0.5
  • External storage support 0.2
  • Full Text Search 0.5.2
  • LDAP user and group backend 0.4.1
  • PDF Viewer 0.2
  • Share Files 0.3.5
  • Text Editor 0.3
  • Versions 1.3.3

Logs

Web server error log

IP addresses and domain name replaced.

[Fri Feb 14 15:32:31 2014] [error] [client 123.123.123.123] PHP Fatal error:  Cannot redeclare class Zend_Search_Lucene_Analysis_Analyzer in /usr/share/php/Zend/Search/Lucene/Analysis/Analyzer.php on line 71, referer: https://owncloud.domain.net/index.php/apps/files
[Fri Feb 14 15:32:31 2014] [error] [client 123.123.123.123] PHP Fatal error:  Cannot redeclare class Zend_Search_Lucene_Analysis_Analyzer in /usr/share/php/Zend/Search/Lucene/Analysis/Analyzer.php on line 71, referer: https://owncloud.domain.net/index.php/apps/files

Owncloud log

When setting cron method to AJAX, the entries below are triggered by entering a search term while Full Text Search is enabled. Essentially the same errors as in the web server error log.

{"app":"PHP","message":"Cannot redeclare class Zend_Search_Lucene_Analysis_Analyzer at \/usr\/share\/php\/Zend\/Search\/Lucene\/Analysis\/Analyzer.php#71","level":3,"time":"2014-02-14T14:26:41+00:00"}
{"app":"PHP","message":"Cannot redeclare class Zend_Search_Lucene_Analysis_Analyzer at \/usr\/share\/php\/Zend\/Search\/Lucene\/Analysis\/Analyzer.php#71","level":3,"time":"2014-02-14T14:26:42+00:00"}
{"app":"PHP","message":"Cannot redeclare class Zend_Search_Lucene_Analysis_Analyzer at \/usr\/share\/php\/Zend\/Search\/Lucene\/Analysis\/Analyzer.php#71","level":3,"time":"2014-02-14T14:29:44+00:00"}
{"app":"PHP","message":"Cannot redeclare class Zend_Search_Lucene_Analysis_Analyzer at \/usr\/share\/php\/Zend\/Search\/Lucene\/Analysis\/Analyzer.php#71","level":3,"time":"2014-02-14T14:29:44+00:00"}

Manual cron execution like I encountered in ticket #3 yields the following output:

$ sudo -u www-data /usr/bin/php -f /var/www/owncloud/cron.php 
PHP Fatal error:  Class 'Zend_Search_Lucene_Exception' not found in /var/www/owncloud/apps/search_lucene/document/Ods.php on line 35
Unexpected error!

Possibly related to:

Issue #3 Class 'Zend_Search_Lucene_Document' not found

I'm at wit's end here, though that may be the end of the week talking. Any input, targeted questions, advice or remarks are appreciated.

Best regards,
Matthias

@karlitschek
Copy link

@butonic Any idea?

@DeepDiver1975
Copy link
Contributor

that class is installed on the system an collides with the class we ship as part of the app.

@JohnnyricoMC Can you try to remove/uninstall the class living in /usr/share/php/Zend/Search/Lucene/Analysis/Analyzer.php?

wild guess:

apt-get remove php-letodms-lucene

@butonic @karlitschek this is why we should introduce composer - composer's autoloader will avoid such collitions

@JohnnyricoMC
Copy link
Author

Thanks for the suggestion @DeepDiver1975.
Removing the zendframework package from the server did take care of the errors, but entering strings located in filenames or in .txt files themselves still yields no results.

On a new test user we do see indexes being created in the /var/www/owncloud/data/username/lucene_index/ folder, but to no avail when attempting to search filenames and file contents. It's as if the indexes aren't being queried when entering a search string.

Unfortunately when performing these actions now, nothing is written to owncloud.log or to the Apache error logs to give a hint, even in loglevel 0.

@butonic
Copy link
Contributor

butonic commented Feb 24, 2014

@JohnnyricoMC The lucene_index folder contains a lucene index. You can have a look at what is stored with Luke - Lucene Index Toolbox.

If you can spare the time, could you review #1 as it fixes some of the known limitations.

@JohnnyricoMC
Copy link
Author

Hi @butonic, sorry for the late response. We made a copy of the data from the production server experiencing the problem to a test server where search_lucene used to work. The result of the data migration: search_lucene no longer worked.

I then applied all the file modifications from pull request #1 , unfortunately to no avail. Upon removing the lucene_index folder from a user's folder and then running cron.php the index files do get made, but after modifying a few files from the webif these index files don't get updated. I fear this issue is somehow caused by the data. Perhaps something is causing the indexing to fail.

@JohnnyricoMC
Copy link
Author

The saga continues:

The issue appears to be related to how search_lucene/lib/status.php handles new files: it appears to get a quota object which it doesn't manage to process, but it can be forced to skip this problematic object and continue indexing:

$wc = 'OC\Files\Storage\Wrapper\Quota';
        if ($storage instanceof $wc) {
                $storage = $storage->getWrapperStorage();
        }

Right now it seems $storage gets filled with a quota object by either $storage = Filesystem::getStorage($mount); or $storage = $mount->getStorage(); in the following conditional structure:

if (is_string($mount)) {
        $storage = Filesystem::getStorage($mount);
} else if ($mount instanceof \OC\Files\Mount\Mount) {
        $storage = $mount->getStorage();
} else {
        $storage = null;
        Util::writeLog('search_lucene',
        'expected string or instance of \OC\Files\Mount\Mount got ' . json_encode($mount),
        Util::DEBUG);
        }

After clearing the oc_lucene_status table, we encounter errors when manually running cron.php, the message returned being Unexpected error!, from function handleUnexpectedShutdown() in cron.php. The items that do get stored in the index table are either deleted files or seem to be false positives (as in the specified search string not appearing in the file returned).

@chrisnew
Copy link

I solved this issue in a different way.

I added to the config/config.php following:

set_include_path(dirname(__FILE__) . '/..');

This let remain your systemwide Zend Framework intact without interfering with owncloud's own copy.

@JohnnyricoMC
Copy link
Author

Hi, just an update: we tried the changes from pull request #1, but they didn't fix the problem with files not getting indexed. Are there any logs we can supply so we can track down the cause and help find a possible fix?

@equaeghe
Copy link

equaeghe commented Jan 5, 2015

On 7.0.4 I am still hit by this bug:

Cannot redeclare class Zend_Search_Lucene_Analysis_Analyzer at /usr/share/php/Zend/Search/Lucene/Analysis/Analyzer.php#71

Note that I am on shared hosting, so I cannot touch /usr.

Searching has never worked for me. Sometimes, when I try it again, I get a message claiming indexing is going on, but nothing ever really seems to happen.

@karlitschek
Copy link

@butonic What do you think?

@butonic
Copy link
Contributor

butonic commented Jan 6, 2015

should be fixed with OC8, which contains search_lucene v0.6

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants