flarum / flarum/framework

Make search term minimum length configurable

Open
#4,970 0 comments 0 reactions 0 assignees View on GitHub
type/feature
Dominant language
PHP
Stars
6.7k
Forks
883
Avg merge
15h 16m
Merged PRs (30d)
73

Description

### Current Behavior

From discuss: https://discuss.flarum.org/d/39713

The built-in search currently enforces a minimum search term length of `3`. This works fine for general searches, but a fixed limit can be too restrictive for some languages and use cases, particularly CJK searches.

It would be useful to make the minimum search term length configurable rather than hard-coding it.

### Steps to Reproduce

Searching CJK character like `中文` will show no result as it is only 2 character.

### Expected Behavior

Allow the search term minimum length to be configurable either in admin panel or in `config.php`.

### Screenshots

_No response_

### Environment

- Flarum version: x.y.z
- Website URL: http://example.com
- Webserver: [e.g. apache, nginx]
- Hosting environment: [e.g. shared, vps]
- PHP version: x.y.z
- Database: [e.g. MySQL 8.4.11, MariaDB 10.11.2, PostgreSQL 16.1, SQLite 3.45]
- Browser: [e.g. chrome 67, safari 11]

### Output of `php flarum info`

```
Output of "php flarum info", run this in terminal in your Flarum directory.
```

### Possible Solution

_No response_

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the built-in search logic that hard-codes the minimum length at 3, then inspect how Flarum exposes configuration through config.php and the admin panel. Done means administrators can configure the minimum term length and CJK searches such as 中文 can return results; verify the existing search behavior and relevant tests after the change.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
search
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.