nextcloud / nextcloud/fulltextsearch
Fulltextsearch shows error when searching on CLI, works perfectly in Web UI
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 234
- Forks
- 64
- Avg merge
- 6h 18m
- Merged PRs (30d)
- 10
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/fulltextsearch/lib/Command/Search.php and compare its argument handling with the web search path. Then inspect apps/fulltextsearch/lib/Service/SearchService.php and apps/files_fulltextsearch/lib/Service/FilesService.php around the reported lines, reproduce both CLI commands, and confirm that missing arguments and search results no longer produce TypeErrors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elasticsearch, php
- Domain
- cli, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100