PHPackages                             tangpeng/think-xunsearch - 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. tangpeng/think-xunsearch

ActiveLibrary

tangpeng/think-xunsearch
========================

基于xunsearch php-sdk集成简单的演示

1.1(8y ago)026[1 issues](https://github.com/xiaotangGitHub/XunSearch/issues)MITPHPPHP &gt;=5.3

Since Dec 13Pushed 8y agoCompare

[ Source](https://github.com/xiaotangGitHub/XunSearch)[ Packagist](https://packagist.org/packages/tangpeng/think-xunsearch)[ RSS](/packages/tangpeng-think-xunsearch/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

*A simple DEMO based on PHP-SDK integration based on XunSearch*
---------------------------------------------------------------

[](#a-simple-demo-based-on-php-sdk-integration-based-on-xunsearch)

```
    /**
     * Search constructor.
     * @param string $file_ini The configuration file of Xun search
     * @param array $config
     */
    public function __construct( $file_ini, array $config = [] )
```

```
    /**
     * @function Get the search results
     * @param $field
     * @return array
     */
    public function search( $field )
```

```
    /**
     * @function Index data added to XunSearch
     * @param array $data
     * @return array
     */
    public function addData( array $data )
```

```
    /**
     * @function Update the index data with the same primary key value
     * @param array $data
     * @return array
     */
    public function updateData( array $data )
```

```
    /**
     * @function Deleting index data based on the primary key value
     * @param $primaryKey
     */
    public function delData( $primaryKey )
```

```
    /**
     * @function Configuring the number of data to search
     * @param int $length
     * @param int $offset
     * @return $this
     */
    public function limit( $length = 10, $offset = 0 )
```

```
    /**
     * @function Scavenging index data when data is seriously out of sync
     */
    public function clear()
```

```
    /**
     * @function After the index data is processed, the index data is refreshed immediately to make it effective
     * Index refresh configuration needs to be opened
     */
    private function refresh()
```

*基于xunsearch php-sdk集成简单的演示*
----------------------------

[](#基于xunsearch-php-sdk集成简单的演示)

```
    /**
     * Search constructor.
     * @param string $file_ini 迅搜的配置文件名
     * @param array $config
     */
    public function __construct( $file_ini, array $config = [] )
```

```
    /**
     * @function 获取搜索结果
     * @param $field
     * @return array
     */
    public function search( $field )
```

```
    /**
     * @function 将索引数据添加到迅搜
     * @param array $data
     * @return array
     */
    public function addData( array $data )
```

```
    /**
     * @function 用相同的主键值更新索引数据
     * @param array $data
     * @return array
     */
    public function updateData( array $data )
```

```
    /**
     * @function 基于主键值删除索引数据
     * @param $primaryKey
     */
    public function delData( $primaryKey )
```

```
    /**
     * @function 配置要搜索的数据的数目
     * @param int $length
     * @param int $offset
     * @return $this
     */
    public function limit( $length = 10, $offset = 0 )
```

```
    /**
     * @function 当数据严重不同步时清除索引数据
     */
    public function clear()
```

```
    /**
     * @function 在处理索引数据之后，立即刷新索引数据以使其生效。
     * 索引刷新配置需要打开
     */
    private function refresh()
```

使用该扩展需编译安装XunSearch，且开启XunSearch服务
----------------------------------

[](#使用该扩展需编译安装xunsearch且开启xunsearch服务)

```
#下载包
mkdir /usr/local/xunsearch
wget http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2
tar -xjf xunsearch-full-latest.tar.bz2
```

```
#安装
cd xunsearch-full-1.3.0/
sh setup.sh
```

```
#查看运行结果
/usr/local/xunsearch/sdk/php/util/RequiredCheck.php -c gbk
```

```
#启动服务并注册服务
/usr/local/xunsearch/bin/xs-ctl.sh restart
cp /usr/local/xunsearch/bin/xs-ctl.sh /etc/init.d/xs-indexed
chkconfig --add xs-indexed
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 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 ~0 days

Total

2

Last Release

3072d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c7a71363eea2f5f20681e4f087057a5767650c1c56eabc6d5bacf6f87b617aa3?d=identicon)[xiaotangGitHub](/maintainers/xiaotangGitHub)

---

Top Contributors

[![xiaotangGitHub](https://avatars.githubusercontent.com/u/33944803?v=4)](https://github.com/xiaotangGitHub "xiaotangGitHub (5 commits)")

### Embed Badge

![Health badge](/badges/tangpeng-think-xunsearch/health.svg)

```
[![Health](https://phpackages.com/badges/tangpeng-think-xunsearch/health.svg)](https://phpackages.com/packages/tangpeng-think-xunsearch)
```

PHPackages © 2026

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