Limit Member Search (minimum length of searchterm / limit # of results)
Open
Nobody has claimed this yet.
0. Needs triage
performance
technical debt
- Dominant language
- JavaScript
- Stars
- 177
- Forks
- 68
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 60
Description
If using "Add Member" and entering some (short) search term, I will get a "Allowed memory size exhausted" message in the log (because there are a lot of users in LDAP). There is no limit for the results and no minimum length for the searchterm.
I propose
- to add a minimum length for the searchterm, maybe by adding
if (strlen($str)<4) return $result;in the searchGlobal function below the$result=[];in lib/Service/SerachService.php - to add a maximum value for the results in lib/Search/LocalUser.php (function search):
$users = $userManager->search($search,20);
(I'm using NC 17.0.3 / Circles 0.17.10)
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
Read lib/Service/SerachService.php and its searchGlobal function, then inspect the search function in lib/Search/LocalUser.php. Reproduce the short-term search behavior and verify that short searches return no results and broader searches are capped, without the LDAP-related memory exhaustion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100