fulltextsearch icon indicating copy to clipboard operation
fulltextsearch copied to clipboard

Fulltextsearch shows error when searching on CLI, works perfectly in Web UI

Open e-alfred opened this issue 5 years ago • 3 comments

My system is running Nextcloud 16.0.1 with the latest Fulltextsearch apps and Elasticsearch 7.2. I indexed everything successfully, but if I try to search anything the following error is thrown:

# sudo -u www-data php occ fulltextsearch:search user linux
search
An unhandled exception has been thrown:
TypeError: Argument 1 passed to OCA\Files_FullTextSearch\Service\FilesService::getFileFromId() must be of the type string, null given, called in /var/www/owncloud/apps/files_fulltextsearch/lib/Service/SearchService.php on line 241 and defined in /var/www/owncloud/apps/files_fulltextsearch/lib/Service/FilesService.php:432
Stack trace:
#0 /var/www/owncloud/apps/files_fulltextsearch/lib/Service/SearchService.php(241): OCA\Files_FullTextSearch\Service\FilesService->getFileFromId(NULL, 51585)
#1 /var/www/owncloud/apps/files_fulltextsearch/lib/Service/SearchService.php(219): OCA\Files_FullTextSearch\Service\SearchService->setDocumentInfo(Object(OCA\Files_FullTextSearch\Model\FilesDocument))
#2 /var/www/owncloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(330): OCA\Files_FullTextSearch\Service\SearchService->improveSearchResult(Object(OCA\FullTextSearch\Model\SearchResult))
#3 /var/www/owncloud/apps/fulltextsearch/lib/Service/SearchService.php(205): OCA\Files_FullTextSearch\Provider\FilesProvider->improveSearchResult(Object(OCA\FullTextSearch\Model\SearchResult))
#4 /var/www/owncloud/apps/fulltextsearch/lib/Service/SearchService.php(161): OCA\FullTextSearch\Service\SearchService->searchFromProviders(Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Array, Object(OC\FullTextSearch\Model\DocumentAccess), Object(OCA\FullTextSearch\Model\SearchRequest))
#5 /var/www/owncloud/apps/fulltextsearch/lib/Command/Search.php(109): OCA\FullTextSearch\Service\SearchService->search('alfred', Object(OCA\FullTextSearch\Model\SearchRequest))
#6 /var/www/owncloud/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Search->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/owncloud/core/Command/Base.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/owncloud/3rdparty/symfony/console/Application.php(901): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/owncloud/3rdparty/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FullTextSearch\Command\Search), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/owncloud/3rdparty/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/owncloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/owncloud/console.php(97): OC\Console\Application->run()
#13 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')

I am also getting this if I run the command without any arguments:

sudo -u www-data php occ fulltextsearch:search
search
An unhandled exception has been thrown:
TypeError: Argument 1 passed to OCA\FullTextSearch\Service\SearchService::search() must be of the type string, null given, called in /var/www/owncloud/apps/fulltextsearch/lib/Command/Search.php on line 109 and defined in /var/www/owncloud/apps/fulltextsearch/lib/Service/SearchService.php:139
Stack trace:
#0 /var/www/owncloud/apps/fulltextsearch/lib/Command/Search.php(109): OCA\FullTextSearch\Service\SearchService->search(NULL, Object(OCA\FullTextSearch\Model\SearchRequest))
#1 /var/www/owncloud/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Search->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/www/owncloud/core/Command/Base.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/owncloud/3rdparty/symfony/console/Application.php(901): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/owncloud/3rdparty/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FullTextSearch\Command\Search), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/owncloud/3rdparty/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/owncloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/owncloud/console.php(97): OC\Console\Application->run()
#8 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')

Interestingly, the search using the Web UI works perfectly fine without any errors.

e-alfred avatar Jun 30 '19 05:06 e-alfred

elasticsearch 7.x IMHO not works, use 6.7

ralfi avatar Jul 01 '19 08:07 ralfi

Searching through the Web UI works perfectly actually using 7.2, this bug appears only on the CLI using the occ command. The error happens even before any search is started on the Elasticsearch instance, it seems that the UID isn't correctly fetched on the Nextcloud server by the occ command.

e-alfred avatar Jul 01 '19 09:07 e-alfred

Confirming that this isssue is still valid with Nextcloud 20.0.4 and the Fulltext-Search Apps in Version 20.0

slankes avatar Jan 03 '21 11:01 slankes