PHPackages                             xj/yii2-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. xj/yii2-xunsearch

AbandonedArchivedLibrary

xj/yii2-xunsearch
=================

yii2-xunsearch

1.0.0(11y ago)5435[1 issues](https://github.com/xjflyttp/yii2-xunsearch/issues)BSD-3-ClausePHP

Since Aug 6Pushed 11y ago1 watchersCompare

[ Source](https://github.com/xjflyttp/yii2-xunsearch)[ Packagist](https://packagist.org/packages/xj/yii2-xunsearch)[ RSS](/packages/xj-yii2-xunsearch/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

yii2-xunsearch
==============

[](#yii2-xunsearch)

composer.json
-------------

[](#composerjson)

```
"require": {
    xj/yii2-xunsearch: "*"
},
```

Configure Components
--------------------

[](#configure-components)

```
return [
    'components' => [
        'xunsearch' => [
            'class' => 'xj\\xunsearch\\Connection',
            //Put Xunsearch ini to $configDirectory
            'configDirectory' => '@common/config/xunsearch',
        ],
    ],
];
```

Create ActiveRecord
-------------------

[](#create-activerecord)

```
class Demo extends \xj\xunsearch\ActiveRecord {

    public static function primaryKey() {
        return ['pid'];
    }

    public function rules() {
        return [
            [['pid', 'subject', 'message'], 'required']
        ];
    }

    public function attributes() {
        return [
            'pid', 'subject', 'message',
        ];
    }

}
```

INSERT
------

[](#insert)

```
$model = new Demo();
$model->setAttributes([
    'pid' => 1,
    'subject' => 'haha',
    'message' => 'hehe',
]);
$model->save();
```

QUERY
-----

[](#query)

```
//where syntax
$models = Demo::find()->where([
            'wild', 'key1', '-key2', // key1 -key2
            'wild', 'key1', 'key2', 'key3', // key1 key2 key3
            'pid' => [5, 6, 7], // (pid:5) OR (pid:6) OR (pid:7)
            'pid' => 5, // pid:5
            'and', 'key1', 'key2', 'key3', // (key1) AND (key2) AND (key3)
            'or', '5', '6', '7', // (5) OR (6) OR (7)
            'and', '啊', ['or', 'pid:30', 'pid:31'] // (啊) AND ((pid:30) OR (pid:31))
        ])->all();
var_dump($models);

//asArray
$models = Demo::find()->where([
            'wild', 'key1', '-key2', // key1 -key2
        ])->asArray()->all();
```

UPDATE
------

[](#update)

```
$model = Demo::findByPk(1);
$model->subject = 'mod subject';
$model->save();
```

DELETE
------

[](#delete)

```
$model = Demo::findByPk(1);
$model->delete();
```

COUNT
-----

[](#count)

```
$count = Demo::find()->where([
            'wild', 'key1',
        ])->count();
```

Work with ActiveDataProvider
----------------------------

[](#work-with-activedataprovider)

```
$query = Demo::find();
$dataProvider = new \yii\data\ActiveDataProvider([
    'query' => $query,
]);
$models = $dataProvider->getModels();
var_dump($models);
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

4298d ago

### Community

Maintainers

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

---

Top Contributors

[![xjflyttp](https://avatars.githubusercontent.com/u/128428?v=4)](https://github.com/xjflyttp "xjflyttp (3 commits)")

### Embed Badge

![Health badge](/badges/xj-yii2-xunsearch/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)

PHPackages © 2026

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