PHPackages                             emma/searchengine - 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. emma/searchengine

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

emma/searchengine
=================

Php - MySql/SQL Search Engine. Considering the challenges in using MySQL/MSSQL/SQL as a back-end for industrial level application search-engine. An optimized techniques and algorithms are developed to boost performance and make SQL databases works like magic for the purpose of searching.

v2.0.2(4y ago)53211GPL-2.0-onlyPHPPHP &gt;=5.4

Since Feb 12Pushed 2y ago2 watchersCompare

[ Source](https://github.com/debascoguy/SearchEngine)[ Packagist](https://packagist.org/packages/emma/searchengine)[ RSS](/packages/emma-searchengine/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)DependenciesVersions (5)Used By (1)

SearchEngine
============

[](#searchengine)

A Php - MySql Search Engine. Considering the challenges in using MySQL/MSSQL/SQL as a back-end for industrial level application search-engine. An optimized techniques and algorithms are developed to boost performance and make SQL databases works like magic for the purpose of searching.

HOW TO USE
==========

[](#how-to-use)

Please see the example in the package after downloading for a fast understanding of how to deploy the library.

SAME EXAMPLE BELOW
==================

[](#same-example-below)

error\_reporting(E\_ALL ^ E\_NOTICE);

include dirname(**FILE**) . DIRECTORY\_SEPARATOR . "autoloader.php";

/\*\*

- Sample Database From:
- [https://github.com/datacharmer/test\_db](https://github.com/datacharmer/test_db)
-
- If using XAMPP and on WINDOWS:
-
- 1. Create an empty database: 'employees'
- 2. Use the test\_db.sql in this repository as I have already helped edit the employees.sql file for ease of import.
- 3. Then, Open Command Line (Windows)
- 4. cd c:\\xampp\\mysql\\bin
- 5. C:\\xampp\\mysql\\bin&gt; mysql -u {username} -p {databasename} &lt; file\_name.sql
-

\*/

/\*\*

- CREATE MYSQL CONNECTION \*/ $connection = SearchEngine\\SQL\\PDOConnection::getInstance(new SearchEngine\\SQL\\ConnectionProperty("localhost", "root", "", "employees"));

/\*\*

- EXAMPLE 1: fulltext search example: First, run this SQL on your employees Database:
-
- ALTER TABLE employees ADD FULLTEXT(first\_name, last\_name);
- ===================================================================================================================== \*/

/\*\* SEARCH STRING : The strings to be search inside the database (Boolean Search). \*/ $searchString = "Georgi OR Paddy OR King NOT Gregory";

$SqlLoadDB = new SearchEngine\\SQL\\SqlLoadDB( $connection, (new SearchEngine\\SQL\\QueryBuilder())-&gt;setTableName("employees"), new SearchEngine\\SentenceAnalyzer\\MysqlFullText( $searchString, \["employees.first\_name", "employees.last\_name"\], SearchEngine\\SentenceAnalyzer\\MysqlFullText::IN\_BOOLEAN\_MODE ) );

//Now, Search $searchEngine = new SearchEngine\\SearchEngine(); $searchEngine-&gt;add($SqlLoadDB) // Register a callback on the Search Engine before viewing of final results (Optional)... -&gt;registerResultCallBack(function ($searchResult) { while (count($searchResult) &lt; 4095) { //Simply duplicate the search to increase the total number of result... //Just an example of how to add an inline callback. $result2 = $searchResult; $searchResult = array\_merge($searchResult, $result2); } return $searchResult; });

$result = $searchEngine-&gt;search()-&gt;getResult();

/\*\*

- EXAMPLE 2 : Test of Using Multiple DataSource By creating another SqlLoadDB()
- ===================================================================================================================== \*/

/\*\* USING QUERY BUILDER TO BUILD YOUR SEARCH QUERY... */ $mysqlQueryBuilder = new SearchEngine\\SQL\\QueryBuilder(); $mysqlQueryBuilder-&gt;select(array( /*\* employees.first\_name As employeesfirst\_name : Use this if duplicate column exist. \*/ "employees.first\_name" =&gt; "First Name", "employees.emp\_no" =&gt; "Employee Number", "employees.birth\_date", "employees.hire\_date", ))-&gt;from("employees") -&gt;leftJoin("dept\_emp", "dept\_emp.emp\_no = employees.emp\_no") -&gt;where("employees.first\_name IN ('Georgi', 'Paddy', 'King')") -&gt;andWhere("employees.first\_name NOT IN ('Gregory')")

```
/** Another Method of Adding Single Column to select() Field-list While also testing the Mysql UNION function */
->union()
->selectColumn("employees.first_name", "First Name")
->selectColumn("employees.emp_no", "Employee Number")
->selectColumn("employees.birth_date")
->selectColumn("employees.hire_date")
->from("employees")
->leftJoin("dept_emp", "dept_emp.emp_no = employees.emp_no")
->where("employees.first_name IN ('Georgi', 'Paddy', 'King')")
->andWhere("employees.first_name NOT IN ('Gregory')");

```

$SqlLoadDB2 = new SearchEngine\\SQL\\SqlLoadDB( $connection, $mysqlQueryBuilder, new SearchEngine\\SentenceAnalyzer\\SqlLike($searchString) ); //Now, Search $searchEngine = $searchEngine-&gt;reset(); $searchEngine-&gt;add($SqlLoadDB2)-&gt;registerResultCallBack(function ($searchResult) { while (count($searchResult) &lt; 4095) { $result2 = $searchResult; $searchResult = array\_merge($searchResult, $result2); } return $searchResult; }); $result2 = $searchEngine-&gt;search()-&gt;getResult();

/\*\*

- EXAMPLE 3: File System Searching... */ /*\* @var SearchEngine\\FileSystem\\SearchOption $fileSystemDataSource */ $fileSystemDataSource = new SearchEngine\\FileSystem\\SearchOption( dirname(**FILE**). DIRECTORY\_SEPARATOR . "dictionary", /*\* &gt;&gt; This can be either file or directory ==&gt;&gt; \*/ "BASIC" ); $fileSystemDataSource-&gt;setGroupResultByFilePath(true); $fileSystemLoadDB = new SearchEngine\\FileSystem\\CtrlF($fileSystemDataSource); //Now, Search $searchEngine = $searchEngine-&gt;reset(); $result3 = $searchEngine-&gt;add($fileSystemLoadDB)-&gt;search()-&gt;getResult();

echo "

### EXAMPLE 1 - SEARCH RESULT

[](#example-1---search-result)

"; var\_dump($result); echo "### EXAMPLE 2 - SEARCH RESULT

[](#example-2---search-result)

"; var\_dump($result2); echo "### EXAMPLE 3 - SEARCH RESULT

[](#example-3---search-result)

"; var\_dump($result3);

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity48

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

4

Last Release

1591d ago

Major Versions

v1.0.0 → v2.0.22022-02-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/17ecf1e99357556e97438ed0d7edbabada5380ff58e4a6a49cda3521f5a15637?d=identicon)[debascoguy](/maintainers/debascoguy)

---

Top Contributors

[![debascoguy](https://avatars.githubusercontent.com/u/12888833?v=4)](https://github.com/debascoguy "debascoguy (25 commits)")

---

Tags

mssqlmysqlphpsearch-enginesearch-in-textsearch-interfacesearchingsearching-algorithmssql

### Embed Badge

![Health badge](/badges/emma-searchengine/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)

PHPackages © 2026

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