nextcloud / fulltextsearch

🔍 Core of the full-text search framework for Nextcloud
GNU Affero General Public License v3.0
212 stars 51 forks source link

unhandled exception when Using external files #434

Closed p3pp0 closed 5 years ago

p3pp0 commented 5 years ago

An unhandled exception has been thrown: Error: Call to a member function getStorage() on null in /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/ExternalFilesService.php:291 Stack trace:

0 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/ExternalFilesService.php(316): OCA\Files_FullTextSearch\Service\ExternalFilesService->getExternalMountById(2)

1 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(896): OCA\Files_FullTextSearch\Service\ExternalFilesService->impersonateOwner(Object(OCA\FullTextSearch\Model\Index))

2 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(491): OCA\Files_FullTextSearch\Service\FilesService->impersonateOwner(Object(OCA\FullTextSearch\Model\Index))

3 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(264): OCA\Files_FullTextSearch\Service\FilesService->updateDocument(Object(OCA\FullTextSearch\Model\Index))

4 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(401): OCA\Files_FullTextSearch\Provider\FilesProvider->updateDocument(Object(OCA\FullTextSearch\Model\Index))

5 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Live.php(291): OCA\FullTextSearch\Service\IndexService->updateDocument(Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Object(OCA\Files_FullTextSearch\Provider\FilesProvider), Object(OCA\FullTextSearch\Model\Index))

6 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Live.php(258): OCA\FullTextSearch\Command\Live->liveCycle()

7 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Live->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

8 /var/www/nextcloud/core/Command/Base.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(946): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

10 /var/www/nextcloud/3rdparty/symfony/console/Application.php(248): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FullTextSearch\Command\Live), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

11 /var/www/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

12 /var/www/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

13 /var/www/nextcloud/console.php(96): OC\Console\Application->run()

14 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

Please let me know if you need further information

p3pp0 commented 5 years ago

installed Version from nextcloud appstore before (same Version ,1.23)... found out, that problematic file is not in actual git version anymore. Copied git repo over app folder. tests/live work fine now, however index just exits without fully indexing

ArtificialOwl commented 5 years ago

version of your Nextcloud ?

p3pp0 commented 5 years ago

i have to add, that i maybe did mix it up with fulltextsearch_files: https://github.com/nextcloud/files_fulltextsearch/issues/33

Problem still existing occ -V shows Nextcloud 15.0.2 occ update:check shows Everything up to date

Appreciate your help! @daita

ArtificialOwl commented 5 years ago

Should be fixed in files_fulltextsearch 1.2.4

p3pp0 commented 5 years ago

thank you @daita so far - i checked it - but without full success

No unhandled exception anymore, but files in external storage still not index if uploaded to external folder via webgui it works fine, but if new file just copied on filesystem to external storage --> not indexed

ArtificialOwl commented 5 years ago

CIFS/Samba ?

It is not implemented yet: when uploaded to the filesystem directly, FTS is not kept updated of the new file.

p3pp0 commented 5 years ago

Nope, just a local path with 777 rights

p3pp0 commented 5 years ago

Whattt? Really? :‘-(( But if i run :index it works totally fine for existing files

ArtificialOwl commented 5 years ago

yes, the thing is that fulltextsearch is not aware that a new file is available, or a file is edited when you're uploading directly on the filesystem. When using the index, FTS just scan all the directory tree of a user.

ArtificialOwl commented 5 years ago

https://github.com/nextcloud/fulltextsearch/wiki/How-FullTextSearch-indexes-your-cloud explains it better :)

p3pp0 commented 5 years ago

thank you @daita . May i ask a question, as i have read that this might be interesting for even more nextcloud users:

What i am willing to do, is using an automatic "mail import" for documents that will be indexed. As the limitations of the nextcloud "Files From Mail-APP are, that this is only working for own mailservers, i decided to write a own solution for a "drop in mailbox" from any imap server. There is a small script collecting imap mails and saving attachments to a predefined path, which is included by "external storage" on the same server. Works great besides indexing, and i would be happy to share this for a new app if you like :-)

Is there any way you could imagine to do indexing, without firing a fulltextsearch:stop, reset, index every night via cronjob?

Best, p3pp0

ArtificialOwl commented 5 years ago

The update on External Files is something I need to implement.

Now, there is no need to stop/reset; doing a :index should check if existing document are up-to-date in our index and index changes only if needed.

However, if you really want to index a new file, you can generate the index manually using IFullTextSearchManager

There is also the idea of creating a Content Provider that would connect to your imapd and index the content directly from there, without generating a file.

ArtificialOwl commented 5 years ago

Your initial issue should be fixed in today's release

p3pp0 commented 5 years ago

@daita Thanks for explanation. I will do :index every night now, should work fine :-) i am afraid i dont have the knowledge to generate index manually or creating a own content provider... i thought it might just be helpfull for others..

Thanks for fixing - i already copied git repo over folder and this works fine for now. Please let me know if external files will also be indexd permanently

Best, p3pp0

ArtificialOwl commented 5 years ago

Let's close this issue. It is known that files uploaded directly on the remote filesystem are not [re]indexed. It is a missing feature.