nextcloud / nextcloud/fulltextsearch

FTS check fails: "TypeError: array_shift() expects parameter 1 to be array, string given" after upgrade

Open
#593 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
234
Forks
64
Avg merge
6h 18m
Merged PRs (30d)
10

Description

Hello!
After Nextcloud upgrade, I am having issues running indexing as well as the basic test script.

Here's the output:

.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  
 - 'document is a simple +test +testing' (result: 1, expected: ["simple"]) ok  
 - 'document is a simple +test -testing' (result: 0, expected: []) ok  
 - 'document is a +simple -test -testing' (result: 0, expected: []) ok  
 - '+document is a simple -test -testing' (result: 1, expected: ["license"]) ok  
 - 'document is a +simple -license +testing' (result: 1, expected: ["simple"]) ok  
Updating documents access. An unhandled exception has been thrown:
TypeError: array_shift() expects parameter 1 to be array, string given in /var/www/html/cloud/apps/fulltextsearch/lib/Service/IndexService.php:297
Stack trace:
#0 /var/www/html/cloud/apps/fulltextsearch/lib/Service/IndexService.php(297): array_shift('*** sensitive p...')
#1 /var/www/html/cloud/apps/fulltextsearch/lib/Service/IndexService.php(204): OCA\FullTextSearch\Service\IndexService->indexDocuments(Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Object(OCA\FullTextSearch\Provider\TestProvider), '*** sensitive p...', Object(OCA\FullTextSearch\Model\IndexOptions))
#2 /var/www/html/cloud/apps/fulltextsearch/lib/Command/Test.php(506): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser(Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Object(OCA\FullTextSearch\Provider\TestProvider), 'user1', Object(OCA\FullTextSearch\Model\IndexOptions))
#3 /var/www/html/cloud/apps/fulltextsearch/lib/Command/Test.php(172): OCA\FullTextSearch\Command\Test->testUpdatingDocumentsAccess(Object(Symfony\Component\Console\Output\ConsoleOutput), Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Object(OCA\FullTextSearch\Provider\TestProvider))
#4 /var/www/html/cloud/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Test->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/html/cloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/cloud/3rdparty/symfony/console/Application.php(1000): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/html/cloud/3rdparty/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FullTextSearch\Command\Test), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/html/cloud/3rdparty/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/cloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/cloud/console.php(100): OC\Console\Application->run()
#11 /var/www/html/cloud/occ(11): require_once('/var/www/html/c...')

This is my config:

Full text search 2.0.0
 
- Search Platform:
Elasticsearch 2.0.0
{
    "elastic_host": [
        "http://127.0.0.1:9200"
    ],
    "elastic_index": "nc",
    "fields_limit": "10000",
    "es_ver_below66": "0",
    "analyzer_tokenizer": "standard"
} 
 
- Content Providers:
Files 2.0.0
{
    "files_local": "1",
    "files_external": "0",
    "files_group_folders": "1",
    "files_encrypted": "0",
    "files_federated": "0",
    "files_size": "100",
    "files_pdf": "1",
    "files_office": "1",
    "files_image": "0",
    "files_audio": "0"
}

I'm using elasticsearch Version: 7.10.0, and Nextcloud 20.0.2 - what could be the problem?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at lib/Service/IndexService.php:297 and follow the calls from lib/Command/Test.php shown in the stack trace. Reproduce the failure with the basic test/indexing flow against Elasticsearch 7.10.0, then inspect the value passed to array_shift during access updates. Done means the test completes without the TypeError and indexing remains functional.

Written by the indexing model from the issue text.

Assessment

Tech stack
elasticsearch, php
Domain
backend, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.