Search by user / fileid / whatever
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 36.9k
- Forks
- 5.2k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 713
Description
Is your feature request related to a problem? Please describe.
We are using Nextcloud as an Electronic Document Management, and we would like to be able to search files by their owner or fileid. We've tried to add these metadatas as comments, in order to allow the search form to find documents by these metadatas. Each document receive automatically 2 comments like "OWNER:John Smith" and "CID:123456".
When you search "Smith", all his files are retrieved.
But adding thousand of comments in table oc_comments causes a Mysql crash because each time a user opens a session, oc_comments table seems to be reindexed by nextcloud. We can see multiple occurrence of this sql statement in the mysql process list :
MariaDB [nextcloud]> show full processlist;
| 113 | nextcloud_db_user | [next.dummy.fr:55116](http://next.dummy.fr:55116/) | nextcloud | Query | 0 | Creating sort index | SELECT * FROM oc_comments WHERE object_type = ‘files’ ORDER BY creation_timestamp DESC, id DESC LIMIT 100 OFFSET 76500 | 0.000 |
| 166 | nextcloud_db_user | [next.dummy.fr:55268](http://next.dummy.fr:55268/) | nextcloud | Query | 0 | Creating sort index | SELECT * FROM oc_comments WHERE object_type = ‘files’ ORDER BY creation_timestamp DESC, id DESC LIMIT 100 OFFSET 76400 | 0.000 |
| 198 | nextcloud_db_user | [next.dummy.fr:55340](http://next.dummy.fr:55340/) | nextcloud | Query | 0 | Creating sort index | SELECT * FROM oc_comments WHERE object_type = ‘files’ ORDER BY creation_timestamp DESC, id DESC LIMIT 100 OFFSET 76500 | 0.000 |
Mysql/MariaDB then runs out of memory and crashes.
Describe the solution you'd like
- Nextcloud shouldn't reindex oc_comments table like this. Why ?
- Maybe Nextcloud should propose another way to add searchable metadatas ?
Describe alternatives you've considered
We can build our own search engine and add metadatas in our own table.
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 by tracing the oc_comments query shown in the report and how comment searches are invoked for files. Compare the current pagination and indexing behavior with the requested owner/fileid search use case; done should include an agreed searchable-metadata approach that avoids the reported MariaDB memory failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, mysql, php
- Domain
- backend, databases, search
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100