PHPackages                             gitzaai/cnsearch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. gitzaai/cnsearch

ActiveFlarum-extension[Search &amp; Filtering](/categories/search)

gitzaai/cnsearch
================

Flarum 2.0 extension for Meilisearch-powered Chinese discussion search

0.2.0(1w ago)084—0%MITPHPPHP ^8.3

Since May 16Pushed 1w agoCompare

[ Source](https://github.com/gitzaai/cnsearch)[ Packagist](https://packagist.org/packages/gitzaai/cnsearch)[ RSS](/packages/gitzaai-cnsearch/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

CN Search for Flarum 2.0
========================

[](#cn-search-for-flarum-20)

`gitzaai/cnsearch` is a Flarum 2 extension that uses Meilisearch as the discussion search backend. It indexes discussion titles and visible comment content, then plugs into Flarum's built-in discussion search flow.

Screenshots
-----------

[](#screenshots)

### Admin Settings

[](#admin-settings)

[![CN Search admin settings](screenshots/admin-settings.png)](screenshots/admin-settings.png)

### Search Results

[](#search-results)

[![CN Search search results](screenshots/search-results.png)](screenshots/search-results.png)

Features
--------

[](#features)

- Uses Meilisearch for discussion full-text search.
- Stores one Meilisearch document per discussion.
- Merges visible comment posts into each discussion document.
- Adds CJK n-gram fields for Chinese, Japanese, Korean, and other CJK search terms.
- Lowers the forum search trigger length so 1-2 character Chinese queries can run.
- Provides admin APIs and console commands for status checks, connection tests, search tests, and reindexing.
- Syncs the index when posts or discussions are created, edited, hidden, restored, or deleted.

Installation
------------

[](#installation)

```
composer require gitzaai/cnsearch
php flarum assets:publish
php flarum cache:clear
```

For Flarum 2.0 beta 8 and newer, run `php flarum assets:publish` after installing or updating the extension to make sure frontend assets match the current extension code.

Configuration
-------------

[](#configuration)

The extension does not ship with a preset Meilisearch host or API key. Configure them in the admin panel, or use the bundled command:

```
php flarum cnsearch:configure https://your-meilisearch.example --index=flarum_discussions
php flarum cache:clear
```

If your Meilisearch instance requires authentication, provide your own key:

```
php flarum cnsearch:configure https://your-meilisearch.example --key=replace_with_your_key --index=flarum_discussions
php flarum cache:clear
```

You can also write the settings directly:

```
INSERT INTO settings (`key`, `value`) VALUES
  ('cnsearch.meili.host', 'https://your-meilisearch.example'),
  ('cnsearch.meili.index', 'flarum_discussions')
ON DUPLICATE KEY UPDATE `value` = VALUES(`value`);
```

If your Flarum database tables use a prefix, replace `settings` with the prefixed table name.

Queue
-----

[](#queue)

CN Search pushes every index update onto Flarum's queue (`SyncDiscussionJob`, `ReindexJob`). With Flarum's default `sync` driver each job still runs in the same request, but using a real queue driver (e.g. `database`) is strongly recommended on busy forums so post creation never blocks on Meilisearch. Configure a queue driver and run `php flarum queue:work` to process jobs in the background.

Verification
------------

[](#verification)

Rebuild the index:

```
php flarum cnsearch:reindex
```

If Flarum reports `There are no commands defined in the "cnsearch" namespace.`, enable **CN Search** in the admin panel first, then run the command again.

Check status:

```
php flarum cnsearch:status
```

`Documents` is the number of indexed Meilisearch documents, which normally matches the number of visible discussions. `Source posts` is the number of visible comment posts included in the index, and can be larger than `Documents`.

Test a search term directly:

```
php flarum cnsearch:search 中文关键词
```

After updating the extension, these commands are useful:

```
composer dump-autoload -o
php flarum cache:clear
php flarum cnsearch:reindex
```

API
---

[](#api)

Search:

```
curl "https://your-flarum-site.example/api/cnsearch/search?q=keyword&page=1&perPage=20"
```

Status checks and reindexing require an admin session:

```
curl "https://your-flarum-site.example/api/cnsearch/status"
curl -X POST "https://your-flarum-site.example/api/cnsearch/reindex"
curl "https://your-flarum-site.example/api/cnsearch/test-connection"
```

Links
-----

[](#links)

- [Packagist](https://packagist.org/packages/gitzaai/cnsearch)
- [Discuss](https://discuss.flarum.org/)
- [Report Issues](https://github.com/gitzaai/cnsearch/issues)

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance98

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~11 days

Total

2

Last Release

12d ago

PHP version history (2 changes)0.1.21PHP &gt;=8.0

0.2.0PHP ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/9eefb441a53f227c90926b9f9b949b78aa525b8167df0f9c1123992923904626?d=identicon)[gitzaai](/maintainers/gitzaai)

---

Top Contributors

[![gitzaai](https://avatars.githubusercontent.com/u/71829418?v=4)](https://github.com/gitzaai "gitzaai (13 commits)")

### Embed Badge

![Health badge](/badges/gitzaai-cnsearch/health.svg)

```
[![Health](https://phpackages.com/badges/gitzaai-cnsearch/health.svg)](https://phpackages.com/packages/gitzaai-cnsearch)
```

###  Alternatives

[flarum-lang/russian

Russian language pack for Flarum.

12127.5k](/packages/flarum-lang-russian)[statamic-rad-pack/meilisearch

meilisearch search driver for Statamic

1670.4k](/packages/statamic-rad-pack-meilisearch)[flarum-lang/french

French language pack to localize the Flarum forum software plus its official and third-party extensions.

1936.5k](/packages/flarum-lang-french)[fostercommerce/meilisearch-connect

114.8k](/packages/fostercommerce-meilisearch-connect)[flarum-lang/german

German language pack for Flarum.

2249.7k](/packages/flarum-lang-german)[medienreaktor/meilisearch

Integrates Meilisearch into Neos.

101.0k](/packages/medienreaktor-meilisearch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
