PHPackages                             rock365/windsearch - 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. rock365/windsearch

ActiveLibrary[Search &amp; Filtering](/categories/search)

rock365/windsearch
==================

WindSearch是一个基于中文分词，由纯PHP开发全文检索引擎，可快速搭建PHP站点的站内搜索，他没有任何繁琐的安装配置、不需要维护调优、不占用服务器内存、可与PHP项目完美融合在一起。

v2.0.0(1y ago)1830—0%2[1 issues](https://github.com/rock365/windsearch/issues)AGPL-3.0-or-laterPHPPHP &gt;=7.3

Since Feb 21Pushed 1y ago2 watchersCompare

[ Source](https://github.com/rock365/windsearch)[ Packagist](https://packagist.org/packages/rock365/windsearch)[ RSS](/packages/rock365-windsearch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

WindSearch 2.0 🔍 ![PHP Version](https://camo.githubusercontent.com/bf6a50b2d958e609800ed1ef401cdc2d41b1a3fa6bf35adbab169342d475a563/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e332532422d627269676874677265656e)
==========================================================================================================================================================================================================================================================

[](#windsearch-20--)

### 让PHP站内搜索变得像呼吸一样简单（新功能开发中...）

[](#让php站内搜索变得像呼吸一样简单新功能开发中)

[![AGPL License](https://camo.githubusercontent.com/ffb937c20430e17b92bc8447e7296d775884afc75267a086cea016d992779f22/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f726f636b3336352f77696e64736561726368)](LICENSE) [![GitHub Stars](https://camo.githubusercontent.com/5de1a5955e8b69421a622803271223bc41f4d95e9033d402cea44a27893b0aad/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f726f636b3336352f77696e647365617263683f7374796c653d736f6369616c)](https://github.com/rock365/windsearch)

👏 **功能新增**

2.0版本新增：

- [即用模式](https://github.com/rock365/windsearch/blob/main/CHANGELOG.md)
- [Faker数据生成](https://github.com/rock365/windsearch/blob/main/CHANGELOG.md)
- [日期格式化](https://github.com/rock365/windsearch/blob/main/CHANGELOG.md)（最新开发版）
- [数字金额转中文金额](https://github.com/rock365/windsearch/blob/main/CHANGELOG.md)（最新开发版）

🚀 **一行代码开启极速搜索体验！**

使用composer安装：

```
composer require rock365/windsearch
```

或 使用Git安装：

```
git clone git@github.com:rock365/windsearch.git
```

或 直接在github下载。

📖 **在线文档**

 偶尔不稳定，多刷新几次就行

🚀 **PHP开发者苦ES久矣！**

还在为Elasticsearch的复杂配置头疼？WindSearch给您：

- **零依赖**：无需Java环境，告别JVM调优噩梦
- **中文友好**：内置中文分词程序，为中文搜索而生
- **闪电速度**：百万数据毫秒级响应
- **中文优化**：内置20万+专业词库，分词精度超98%
- **内存克星**：小内存也能搜索大数据，内存占用为零

🚀 **众多优势**

- ✅ 比数据库LIKE快**300倍**，比ES轻量**90%**
- ✅ 天然适配**Laravel**/**ThinkPHP**等主流框架
- ✅ 支持「全文搜索」「同义词扩展」「字段权重优化」「自定义分词插件」等
- ✅ 支持增量索引合并
- ✅ 支持实时索引、实时搜索
- ✅ 支持搜索过滤
- ✅ 支持int递增主键、uuid主键

🚀 **快速使用（配合[文档](https://rock365.github.io/)使用更佳）**

*环境要求：*

- UTF-8编码
- PHP ≥7.3
- mbstring Extension
- PDO Extension
- SQLite Extension

*引入入口文件：*

WindSearch安装完成后，引入入口文件，注意具体文件路径

```
require_once 'yourdirname/vendor/autoload.php';
```

*建索引库：*

复制修改粘贴即可，跟mysql建表差不多

```
$mapping = [
  	//设置索引库的名称，比如对应的表名
    'name' => 'test',
    // 字段配置
    'field' => [
        [
            'name' => 'id',// 主键名称 主键必须设置
            'type' => 'primarykey', //数据类型为主键 必须设置
            'primarykey_type' => 'Int_Incremental', // int递增
        ],
        [
            'name' => 'title',
            'index' => true, // 是否索引此字段
            'type' => 'text',
            'analyzer' => 'segment', // 配置分词方式
        ],
        [
            'name' => 'tags',
            'index' => true,
            'type' => 'keyword',
        ]
        [
            'name' => 'score',
            'type' => 'numeric',
        ],
        [
            'name' => 'time',
            'type' => 'date'
        ],

        [
            'name' => 'descr',
            'type' => 'text',
        ],

    ]

];

// 实例化对象
$Wind = new \WindSearch\Index\Wind('test'); //test 当前索引库的名称
//检查是否存在此索引库
$is_index = $Wind->checkIndex();
// 如果存在此索引库
if ($is_index) {
    //删除索引库
    $Wind->delIndex();
}
//创建索引库
$Wind->createIndex($mapping);
```

*导入数据：*

```
//实例化引擎
$Wind = new \WindSearch\Index\Wind('test');
// 初始化
$Wind->buildIndexInit();
// 开启分词，导入数据时，加true可加快速度
$Wind->loadAnalyzer(true);

// 数据量小（内容少于一万条），则可以一次性全部导入
// selectAll...
// $result：一次性查询的所有内容
foreach ($result as $v) {
    $Wind->indexer($v);
}
// 批量写入文件保存
$Wind->batchWrite();
```

*构建索引：*

```
// 数据导入结束后，接着可立即调用此方法构建索引
// 注意，数据量大时，此步骤会比较耗时
$Wind->buildIndex();
```

*开始搜索：*

```
//实例化引擎
$Wind = new \WindSearch\Index\Wind('test');

//开启分词功能
$Wind->loadAnalyzer();

//开始搜索

// 搜索单个字段
$query = [
    'match' => [
        'field' => [
            'name' => 'title',
            'query' => $text,
        ],
        'list_rows' => $listRows, //每页多少条数据
        'page' => $page, //第几页

    ]

];

// 搜索接口
$res = $Wind->search($query, $page, $listRows);
// 返回的最终结果，可直接渲染到前台页面
$resArr = $res['result']['_source'];
```

以上流程可以快速实现一个PHP全文检索，当然，这些只是餐前小菜，WindSearch还有更深入、更丰富的搜索功能等你挖掘：

在线开发文档： 偶尔访问不稳定，多刷新几次即可

### 👏 让PHP再次伟大！

[](#-让php再次伟大)

点个star吧亲亲O(∩\_∩)O~~谢谢大家！

*联系方式：*

微信：azg555666

[![](https://github.com/rock365/img/raw/main/afe22e05ee161083cfbd1336f7facd2.jpg)](https://github.com/rock365/img/blob/main/afe22e05ee161083cfbd1336f7facd2.jpg)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance45

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity32

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

Unknown

Total

1

Last Release

452d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e4ade20437ef3bd2800a1daa2868338bd89e5e23d628888bb0853c2d7462d3e?d=identicon)[rock365](/maintainers/rock365)

---

Top Contributors

[![rock365](https://avatars.githubusercontent.com/u/174769129?v=4)](https://github.com/rock365 "rock365 (47 commits)")

### Embed Badge

![Health badge](/badges/rock365-windsearch/health.svg)

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

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15224.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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