nextcloud / nextcloud/fulltextsearch

HUGE warning log during indexing due to unsupported "LIMIT -1" in mysql query

Open
#511 8 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

When I'm running the occ fulltextsearch:index on the console, my log files fill up to Gig Bytes within seconds!!! The reason being that the query uses LIMIT -1 which is not supported by MySQL:

Exception while generateDocument: An exception occurred while executing 'SELECT uid, displayname FROM oc_users u LEFT JOIN oc_preferences p ON (userid = uid) AND (appid = 'settings') AND (configkey = 'email') WHERE (uid COLLATE utf8mb4_general_ci LIKE ?) OR (displayname COLLATE utf8mb4_general_ci LIKE ?) OR (configvalue COLLATE utf8mb4_general_ci LIKE ?) ORDER BY uid_lower ASC LIMIT -1 OFFSET 0' with params ["%%", "%%", "%%"]: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-1 OFFSET 0' at ...

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 by reproducing occ fulltextsearch:index with MySQL and inspect the query that generates LIMIT -1 OFFSET 0. The fix is done when indexing no longer emits the unsupported MySQL query or fills the logs with repeated warnings.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql, php
Domain
databases, 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.