PHPackages                             nqxcode/search-engine - 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. [Database &amp; ORM](/categories/database)
4. /
5. nqxcode/search-engine

ActiveLibrary[Database &amp; ORM](/categories/database)

nqxcode/search-engine
=====================

Search engine for ORM based on Zend Lucene.

v1.0.6(11y ago)1791MITPHPPHP &gt;=5.3.3

Since Feb 25Pushed 11y ago1 watchersCompare

[ Source](https://github.com/nqxcode/search-engine)[ Packagist](https://packagist.org/packages/nqxcode/search-engine)[ RSS](/packages/nqxcode-search-engine/feed)WikiDiscussions master Synced today

READMEChangelog (6)Dependencies (4)Versions (8)Used By (0)

Search engine for ORM based on Zend Lucene
==========================================

[](#search-engine-for-orm-based-on-zend-lucene)

[![Latest Stable Version](https://camo.githubusercontent.com/66e97323bed07c070dd64fab2719e7dd0c27b3b9aedd1c78bb6a3f702a503028/68747470733a2f2f706f7365722e707567782e6f72672f6e7178636f64652f7365617263682d656e67696e652f762f737461626c652e706e67)](https://packagist.org/packages/nqxcode/search-engine)[![Total Downloads](https://camo.githubusercontent.com/edea12a34048d9c5dfaf0a98c677cc7c141a2bc47679d19ad462441a0e540f88/68747470733a2f2f706f7365722e707567782e6f72672f6e7178636f64652f7365617263682d656e67696e652f646f776e6c6f6164732e706e67)](https://packagist.org/packages/nqxcode/search-engine)[![Latest Unstable Version](https://camo.githubusercontent.com/142217117f327f99384507def560248d5caeaa96d9ff16153968a6f7414a8a09/68747470733a2f2f706f7365722e707567782e6f72672f6e7178636f64652f7365617263682d656e67696e652f762f756e737461626c652e706e67)](https://packagist.org/packages/nqxcode/search-engine)[![License](https://camo.githubusercontent.com/a7a03d60c9272bcd1242229407767e2262b5a2d0b2374d6c6f8d07761106baf7/68747470733a2f2f706f7365722e707567782e6f72672f6e7178636f64652f7365617263682d656e67696e652f6c6963656e73652e706e67)](https://packagist.org/packages/nqxcode/search-engine)

Search engine gives opportunity of indexing of models (ActiveRecord) on demanded fields. Search engine uses the morphological filter for english and russian words. Morphological filter based on "phpMorphy" (morphological analyzer library).

In order that the model was available to indexation, it is necessary:

1. Add name of class of model to list of model classes at initialization search engine.
2. Declare model with `ISearchable` interface;

Usage
-----

[](#usage)

### Initialization on search engine

[](#initialization-on-search-engine)

```
$searchEngine = new SearchEngine\Engine('Product', $indexDirectory); // $indexDirectory path to index directory
```

### Declare model with `ISearchable` interface

[](#declare-model-with-isearchable-interface)

```
use SearchEngine\ISearchable;

class Product implements ISearchable
{
    // TODO ...
}
```

#### Example of realization `getAttributesForIndexing` method of `ISearchable` interface

[](#example-of-realization-getattributesforindexing-method-of-isearchable-interface)

```
use SearchEngine\ISearchable;

class Product implements ISearchable
{
    // ...

    public funtion getAttributesForIndexing()
    {
        // list of couples "field name - field value"
        return array(
            new Attribute('fieldName', $this->fieldName),
            new Attribute('otherFieldName', $this->otherFieldName)
        );
    }
}
```

### Operation on index

[](#operation-on-index)

#### Full update for search index

[](#full-update-for-search-index)

```
$searchEngine->fullUpdateIndex();
```

#### Update index for `ISearchable` model

[](#update-index-for-isearchable-model)

```
$searchEngine->updateIndex($model);
```

#### Delete index for `ISearchable` model

[](#delete-index-for-isearchable-model)

```
$searchEngine->deleteIndex($model);
```

### Execute search query

[](#execute-search-query)

```
/**
 * @var ZendSearch\Lucene\Search\QueryHit[] $hits
 */
$queryHits = $searchEngine->search($query);
```

#### Get result for paginator

[](#get-result-for-paginator)

```
/**
 * @var SearchEngine\Result\Hit[] $hits
 */
$hits = $searchEngine->parseHitsByRange($queryHits, $elementsPerPage, $currentPage);

// get the found ISearchable model from each $hit
foreach ($hits as $hit):
    $model = $hit->getItem();
}
```

#### Get full result

[](#get-full-result)

```
/**
 * @var SearchEngine\Result\Hit[] $hits
 */
$hits = $searchEngine->parseHits($queryHits);

// get the found ISearchable model from each $hit
foreach ($hits as $hit):
    $model = $hit->getItem();
}
```

License
-------

[](#license)

Search engine licenced under the MIT license.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

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

Every ~25 days

Recently: every ~38 days

Total

7

Last Release

4305d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/75d008474c86762490f249a6f2f1bc5f4728ca2dea466ca26fbb72dfb928a533?d=identicon)[nqxcode](/maintainers/nqxcode)

---

Top Contributors

[![nqxcode](https://avatars.githubusercontent.com/u/5667387?v=4)](https://github.com/nqxcode "nqxcode (35 commits)")

---

Tags

searchormlucene

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nqxcode-search-engine/health.svg)

```
[![Health](https://phpackages.com/badges/nqxcode-search-engine/health.svg)](https://phpackages.com/packages/nqxcode-search-engine)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[doctrine/doctrine-bundle

Symfony DoctrineBundle

4.8k241.3M3.3k](/packages/doctrine-doctrine-bundle)[doctrine/persistence

The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.

4.1k286.5M762](/packages/doctrine-persistence)[gedmo/doctrine-extensions

Doctrine behavioral extensions

4.1k118.8M365](/packages/gedmo-doctrine-extensions)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[beberlei/doctrineextensions

A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.

2.1k75.1M146](/packages/beberlei-doctrineextensions)

PHPackages © 2026

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