nextcloud / fulltextsearch_elasticsearch

πŸ” Use Elasticsearch to index the content of your Nextcloud
https://apps.nextcloud.com/apps/fulltextsearch_elasticsearch
GNU Affero General Public License v3.0
81 stars 30 forks source link

NC 24.0.1 / EC 7.17.3: Error: Call to a member function getUID() on null in /var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php:449 #193

Closed ralfi closed 7 months ago

ralfi commented 2 years ago

Hi,

fulltextsearch indexing breaks with stack trace. It seems to be it could be related to LDAP user who are integrated because the stacktrace tell me...

`#0 /var/www/html/custom_apps/files_fulltextsearch/lib/Service/FilesService.php(324): OCA\Files_FullTextSearch\Service\FilesService->generateFilesDocumentFromFile('0044CAF4-FC64-4...', Object(OC\Files\Node\File))

1 /var/www/html/custom_apps/files_fulltextsearch/lib/Provider/FilesProvider.php(269): OCA\Files_FullTextSearch\Service\FilesService->getFilesFromUser('0044CAF4-FC64-4...', '/Pressespiegel/...')

2 /var/www/html/custom_apps/fulltextsearch/lib/Service/IndexService.php(183): OCA\Files_FullTextSearch\Provider\FilesProvider->generateIndexableDocuments('0044CAF4-FC64-4...', '/Pressespiegel/...')

3 /var/www/html/custom_apps/fulltextsearch/lib/Command/Index.php(416): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser(Object(OCA\FullTextSearch_Elasticsearch\Platform\ElasticSearchPlatform), Object(OCA\Files_FullTextSearch\Provider\FilesProvider), '0044CAF4-FC64-4...', Object(OCA\FullTextSearch\Model\IndexOptions))

4 /var/www/html/custom_apps/fulltextsearch/lib/Command/Index.php(279): OCA\FullTextSearch\Command\Index->indexProvider(Object(OCA\Files_FullTextSearch\Provider\FilesProvider), Object(OCA\FullTextSearch\Model\IndexOptions))

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

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

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

8 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FullTextSearch\Command\Index), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

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

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

11 /var/www/html/console.php(99): OC\Console\Application->run()

12 /var/www/html/occ(11): require_once('/var/www/html/c...')

` Generic NC user are not affected.

ralfi commented 2 years ago

playing around this issue this is not related to external storage as i guess first. But is this the correct place here or shoukld this moved to nextcloud/fulltextsearch? I dont know.

Sanookmakmak commented 2 years ago

I have it too.

Ubuntu 20.04 + NC 24.0.1 + EL 7.17.4 + ingest-attachments plugin + Kibana

Currently there are only local files, neither external storage nor group folders.

occ fulltextsearch:stop
occ fulltextsearch:reset
occ fulltextsearch:check
occ fulltextsearch:test

are OK and the index will be created:

tail -f /var/log/elasticsearch/elasticsearch.log
[2022-06-09T06:20:20,339][INFO ][o.e.c.m.MetadataDeleteIndexService] [localhost.localdomain] [nextcloud/vZRe9LRyQGS_Pj0c0ZodDg] deleting index
[2022-06-09T06:20:29,776][INFO ][o.e.c.m.MetadataCreateIndexService] [localhost.localdomain] [nextcloud] creating index, cause [api], templates [], shards [1]/[1]

But

occ fulltextsearch:index

does not work.

Options: []
Memory: 37 MB
β”Œβ”€ Indexing  ────
β”‚ Action: generateIndexFiles
β”‚ Provider: Files                Account: admin
β”‚ Document: 
β”‚ Info: 
β”‚ Title: 
β”‚ Content size: 
β”‚ Chunk:      1/1
β”‚ Progress:      0/0
└──
β”Œβ”€ Results ────
β”‚ Result:      0/0
β”‚ Index: 
β”‚ Status: 
β”‚ Message: 
β”‚ 
β”‚ 
└──
β”Œβ”€ Errors ────
β”‚ Error:      0/0
β”‚ Index: 
β”‚ Exception: 
β”‚ Message: 
β”‚ 
β”‚ 
└──
## x:first result ## c/v:prec/next result ## b:last result
## f:first error ## h/j:prec/next error ## d:delete error ## l:last error
## q:quit ## p:pause 
An unhandled exception has been thrown:
Error: Call to a member function getUID() on null in /var/www/clients/client1/web2/web/apps/files_fulltextsearch/lib/Service/FilesService.php:449
Stack trace:
#0 /var/www/clients/client1/web2/web/apps/files_fulltextsearch/lib/Service/FilesService.php(421): OCA\Files_FullTextSearch\Service\FilesService->generateFilesDocumentFromFile()
#1 /var/www/clients/client1/web2/web/apps/files_fulltextsearch/lib/Service/FilesService.php(318): OCA\Files_FullTextSearch\Service\FilesService->generateFilesDocumentFromParent()
#2 /var/www/clients/client1/web2/web/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(269): OCA\Files_FullTextSearch\Service\FilesService->getFilesFromUser()
#3 /var/www/clients/client1/web2/web/apps/fulltextsearch/lib/Service/IndexService.php(183): OCA\Files_FullTextSearch\Provider\FilesProvider->generateIndexableDocuments()
#4 /var/www/clients/client1/web2/web/apps/fulltextsearch/lib/Command/Index.php(416): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser()
#5 /var/www/clients/client1/web2/web/apps/fulltextsearch/lib/Command/Index.php(279): OCA\FullTextSearch\Command\Index->indexProvider()
#6 /var/www/clients/client1/web2/web/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Index->execute()
#7 /var/www/clients/client1/web2/web/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run()
#8 /var/www/clients/client1/web2/web/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#9 /var/www/clients/client1/web2/web/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#10 /var/www/clients/client1/web2/web/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#11 /var/www/clients/client1/web2/web/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#12 /var/www/clients/client1/web2/web/console.php(99): OC\Console\Application->run()
#13 /var/www/clients/client1/web2/web/occ(11): require_once('/var/www/client...')
ralfi commented 2 years ago

Hi,

do you have LDAP users?

ArtificialOwl commented 2 years ago

this might fix it: https://github.com/nextcloud/files_fulltextsearch/pull/170

Sanookmakmak commented 2 years ago

The error occurred after WebDAV was added as external storage with an invalid certificate. The filenames were displayed on the NC UI but could not be opened and the external memory was incorrectly marked as "green" on the settings page of NC.

Therefore the error in the NC log file

{
  "reqId": "BYWRtLvtsH6basECZu6W",
  "level": 2,
  "time": "June 09, 2022 11:54:08",
  "remoteAddr": "192.168.0.2",
  "user": "admin",
  "app": "no app in context",
  "method": "GET",
  "url": "/remote.php/webdav/Data/file.txt",
  "message": "Host 192.168.0.9 was not connected to because it violates local access rules",
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0",
  "version": "24.0.1.1"
}

after doing

occ fulltextsearch:index

Sanookmakmak commented 2 years ago

this might fix it: nextcloud/files_fulltextsearch#170

it appears to work, thank you.

hendrik1120 commented 2 years ago

Worked for me too! Thanks

ralfi commented 2 years ago

Worked also for me, thank you very much!

joshtrichards commented 7 months ago

Fixed in nextcloud/files_fulltextsearch#170