FullTextSearch Return value must be of type array

Hello all. I have a snap install of NextCloud running the latest version. I am trying to get ElasticSearch running with it. I think I have the index created, but am getting the following error when I run “sudo snap run nextcloud.occ fulltextsearch:test”. Can someone help please?

Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 items) ok
Loading search platform. (Elasticsearch) ok
Testing search platform. ok
Locking process ok
Removing test. ok
Pausing 3 seconds 1 2 3 ok
Initializing index mapping. ok
Indexing generated documents. ok
Pausing 3 seconds 1 2 3 ok
Retreiving content from a big index (license). (size: 32386) ok
Comparing document with source. ok
Searching basic keywords:

  • ‘test’ An unhandled exception has been thrown:
    TypeError: Return value of OCA\FullTextSearch\Model\SearchRequest::getProviders() must be of the type array, null returned in /var/snap/nextcloud/21026/nextcloud/extra-apps/fulltextsearch/lib/Model/SearchRequest.php:114
    Stack trace:
    #0 /var/snap/nextcloud/21026/nextcloud/extra-apps/fulltextsearch/lib/Model/SearchRequest.php(700): OCA\FullTextSearch\Model\SearchRequest->getProviders()
    #1 [internal function]: OCA\FullTextSearch\Model\SearchRequest->jsonSerialize()
    #2 /var/snap/nextcloud/21026/nextcloud/extra-apps/fulltextsearch_elasticsearch/lib/Service/SearchService.php(103): json_encode(Object(OCA\FullTextSearch\Model\SearchRequest))
    #3 /var/snap/nextcloud/21026/nextcloud/extra-apps/fulltextsearch_elasticsearch/lib/Platform/ElasticSearchPlatform.php(336): OCA\FullTextSearch_ElasticSearch\Service\SearchService->searchRequest(Object(Elasticsearch\Client), Object(OCA\FullTextSearch\Model\SearchResult), Object(OC\FullTextSearch\Model\DocumentAccess))
    #4 /var/snap/nextcloud/21026/nextcloud/extra-apps/fulltextsearch/lib/Command/Test.php(584): OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform->searchRequest(Object(OCA\FullTextSearch\Model\SearchResult), Object(OC\FullTextSearch\Model\DocumentAccess))
    #5 /var/snap/nextcloud/21026/nextcloud/extra-apps/fulltextsearch/lib/Command/Test.php(436): OCA\FullTextSearch\Command\Test->search(Object(Symfony\Component\Console\Output\ConsoleOutput), Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Object(OCA\FullTextSearch\Provider\TestProvider), Object(OC\FullTextSearch\Model\DocumentAccess), ‘test’, Array)
    #6 /var/snap/nextcloud/21026/nextcloud/extra-apps/fulltextsearch/lib/Command/Test.php(171): OCA\FullTextSearch\Command\Test->testSearchSimple(Object(Symfony\Component\Console\Output\ConsoleOutput), Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Object(OCA\FullTextSearch\Provider\TestProvider))
    #7 /snap/nextcloud/21026/htdocs/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Test->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #8 /snap/nextcloud/21026/htdocs/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #9 /snap/nextcloud/21026/htdocs/3rdparty/symfony/console/Application.php(915): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #10 /snap/nextcloud/21026/htdocs/3rdparty/symfony/console/Application.php(272): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FullTextSearch\Command\Test), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #11 /snap/nextcloud/21026/htdocs/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #12 /snap/nextcloud/21026/htdocs/lib/private/Console/Application.php(214): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #13 /snap/nextcloud/21026/htdocs/console.php(99): OC\Console\Application->run()
    #14 /snap/nextcloud/21026/htdocs/occ(11): require_once(’/snap/nextcloud…’)
    #15 {main}

Hi there! I don’t have a solution but i get the exact same error. Everything else seems fine. Would be great if someone had an idea!

Hello . i have exactly the same behaviour after calling sudo -u www-data php occ fulltextsearch:test.
Nexcloud version 18.0.5.
Does anyone here have experience with this bug?
Thanks in advance

Wow, getting an answer is not easy! No communication in a week? Come on guys, help us out here!

Same exact problem also here with new Nextcloud installation.

I haven’t tested fulltextsearch with the 18.xx-series.

But as for Nextcloud 19 on Apache 2.4.43 and PHP 7.4.6 ( cgi-fcgi) fulltextsearch is working flawlessly:

sudo -u www-data php occ fulltextsearch:test

.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 items) ok
Loading search platform. (Elasticsearch) ok
Testing search platform. ok
Locking process ok
Removing test. ok
Pausing 3 seconds 1 2 3 ok
Initializing index mapping. ok
Indexing generated documents. ok
Pausing 3 seconds 1 2 3 ok
Retreiving content from a big index (license). (size: 32386) ok
Comparing document with source. ok
Searching basic keywords:

  • ‘test’ (result: 1, expected: [“simple”]) ok
  • ‘document is a simple test’ (result: 2, expected: [“simple”,“license”]) ok
  • ‘“document is a test”’ (result: 0, expected: []) ok
  • ‘“document is a simple test”’ (result: 1, expected: [“simple”]) ok
  • ‘document is a simple -test’ (result: 1, expected: [“license”]) ok
  • ‘document is a simple +test’ (result: 1, expected: [“simple”]) ok
  • ‘-document is a simple test’ (result: 0, expected: []) ok
    Updating documents access. ok
    Pausing 3 seconds 1 2 3 ok
    Searching with group access rights:
  • ‘license’ - [] - (result: 0, expected: []) ok
  • ‘license’ - [“group_1”] - (result: 1, expected: [“license”]) ok
  • ‘license’ - [“group_1”,“group_2”] - (result: 1, expected: [“license”]) ok
  • ‘license’ - [“group_3”,“group_2”] - (result: 1, expected: [“license”]) ok
  • ‘license’ - [“group_3”] - (result: 0, expected: []) ok
    Searching with share rights:
  • ‘license’ - notuser - (result: 0, expected: []) ok
  • ‘license’ - user2 - (result: 1, expected: [“license”]) ok
  • ‘license’ - user3 - (result: 1, expected: [“license”]) ok
    Removing test. ok
    Unlocking process ok

Hello community,

I have exactly the same error message when trying occ fulltextsearch:test. I also tried to reinstall plugins after purging elasticsearch. Same error. Indexing seemed to work (enduring a long long time-about 12 hours) but after that: same error. NC 18.0.5, Debian 10 (apache2, php over apt).

Simon

Hi!
Same problem here, NC 18.0.6, on ArchLinux, php 7.4.6, apache 2.4.43, Kernel 5.4.43-1-lts. Everything OK but the fulltextsearch… It was working good until the upgrade to the last v18 version

Giovanni

hello
after a week of searching for errors (without result) i reinstalled my Nextcloudserver with Nextcloud 19.0.0
server: Debian 10 (buster)
apache2
PHP 7.4.5 (cli) (built: Jun 3 2020 20:55:00) ( NTS )
Copyright © The PHP Group
Zend Engine v3.4.0, Copyright © Zend Technologies
with Zend OPcache v7.4.5, Copyright ©, by Zend Technologies
elasticsearch-7.7.1

use instructions: (thanks to the authors / companies)


Aps: (I have ignored the warning that these are untested)
Full text search
Full text search - Elasticsearch Platform
Full text search - Files
Full text search - Files - Tesseract OCR
currently the index is building up and the system runs with about 800GB of data (server Intel I5 12GB RAM)
Hard drives : / =120GB SSD
/var/ = 4BT SATA
Backup = internal 4TB SATA (for MySQL backup and NC backup with rsync and mysqldump )

a sudo -u www-data php occ fulltextsearch:test
shows (indexing is still ongoing):

Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 items) ok
Loading search platform. Elasticsearch. Okay.
Testing search platform. ok
Locking process fail
In RunningService.php line 86:

Index is already running

I hope that it will be helpful to you.

./occ fulltextsearch:stop
./occ fulltextsearch:test

Also, if you still have errors, please post the result of your ./occ fulltextsearch:check

@cult This is on NC19 with ES7.8

sudo -u www-data php ./occ fulltextsearch:test

.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 items) ok
Loading search platform. (Elasticsearch) ok
Testing search platform. ok
Locking process ok
Removing test. ok
Pausing 3 seconds 1 2 3 ok
Initializing index mapping. ok
Indexing generated documents. ok
Pausing 3 seconds 1 2 3 ok
Retreiving content from a big index (license). (size: 32386) ok
Comparing document with source. ok
Searching basic keywords:

  • ‘test’ An unhandled exception has been thrown:
    TypeError: Return value of OCA\FullTextSearch\Model\SearchRequest::getProviders() must be of the type array, null returned in /var/www/nextcloud/apps/fulltextsearch/lib/Model/SearchRequest.php:114
    Stack trace:
    #0 /var/www/nextcloud/apps/fulltextsearch/lib/Model/SearchRequest.php(700): OCA\FullTextSearch\Model\SearchRequest->getProviders()
    #1 [internal function]: OCA\FullTextSearch\Model\SearchRequest->jsonSerialize()
    #2 /var/www/nextcloud/apps/fulltextsearch_elasticsearch/lib/Service/SearchService.php(103): json_encode()
    #3 /var/www/nextcloud/apps/fulltextsearch_elasticsearch/lib/Platform/ElasticSearchPlatform.php(336): OCA\FullTextSearch_ElasticSearch\Service\SearchService->searchRequest()
    #4 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Test.php(584): OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform->searchRequest()
    #5 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Test.php(436): OCA\FullTextSearch\Command\Test->search()
    #6 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Test.php(171): OCA\FullTextSearch\Command\Test->testSearchSimple()
    #7 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Test->execute()
    #8 /var/www/nextcloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run()
    #9 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1012): OC\Core\Command\Base->run()
    #10 /var/www/nextcloud/3rdparty/symfony/console/Application.php(272): Symfony\Component\Console\Application->doRunCommand()
    #11 /var/www/nextcloud/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun()
    #12 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
    #13 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
    #14 /var/www/nextcloud/occ(11): require_once(’/var/www/nextcl…’)

for messages in the log like “500 - {“request”:{“providers”:[“deck”,“files”],“author”:“xxxxx”,“search”:“test”,“page”:1,“size”:10,“parts”:[],“queries”:[],“options”:{“files_local”:“1”,“files_group_folders”:“1”,“files_extension”:”"},“metatags”:[],“subtags”:[],“tags”:[]},“version”:“1.4.1”,“status”:-1,“exception”:“Elasticsearch\Common\Exceptions\BadRequest400Exception”,“message”:"{“error”:{“root_cause”:[{“type”:“x_content_parse_exception”,“reason”:"[1:63] [bool] failed to parse field [should]"}],“type”:“x_content_parse_exception”,“reason”:"[1:63] [bool] failed to parse field [must]",“caused_by”:{“type”:“x_content_parse_exception”,“reason”:"[1:63] [bool] failed to parse field [should]",“caused_by”:{“type”:“x_content_parse_exception”,“reason”:"[1:63] [bool] failed to parse field [should]",“caused_by”:{“type”:“illegal_state_exception”,“reason”:“expected value but got [START_ARRAY]”}}}},“status”:400}"}"

… this solution works for me:

goto /var/www/nextcloud/apps/fulltextsearch_elasticsearch/lib/Service
edit SearchMappingService.php
replace: $queryWords[$queryContent->getShould()][] =
to: $queryWords[$queryContent->getShould()] =
replace: $query[$itemShould][] = $queryWords[$itemShould];
to: $query[$itemShould] = $queryWords[$itemShould];
restart elasticsearch service
restart appache2 (webserver)
:wink:

hope it helps