Searcher
Database searcher for Phalcon Framework. This is the search service is designed to search multiple SQL tables. Convenient to use autocomplete, search documents, search the whole site.
Install / Use
/learn @stanislav-web/SearcherREADME
Phalcon Database Searcher
Extension is used to group search for project models. (Currently under TDD)
Description
This is the search service is designed to search multiple SQL tables. Convenient to use autocomplete, search documents, search the whole site.
Change Log
[v 1.0-beta] 2014-12-16
- support MySQL
- support column type such as INT, VARCHAR, CHAR, TEXT, DATE, DATETIME
- fulltext search
- support all main expressions (where, order, group, limit, offset)
- multi table search
- compatible with \Phalcon\Paginator
- view results as json, serialized, array or \Phalcon\Mvc\Model\Resultset\Simple
- support callbacks to pretty modifying result
Compatible
- PSR-0, PSR-1, PSR-2, PSR-4 Standards
System requirements
- PHP 5.5.x >
- MySQL
- Phalcon extension 1.3.x
Install
First update your dependencies through composer. Add to your composer.json:
"require": {
"stanislav-web/phalcon-searcher": "dev-master",
}
Then run to update dependency and autoloader
php composer.phar update
php composer.phar install
or just
php composer.phar require stanislav-web/phalcon-searcher dev-master
(Do not forget to include the composer autoloader)
Or manual require in your loader service
$loader->registerNamespaces([
'Searcher\Searcher' => 'path to src'
]);
You can create an injectable service
$this->di['searcher'] = function() {
return new \Searcher\Searcher();
};
Usage
Simple usage
<?php
use \Searcher\Searcher;
// create object instance
$searcher = new Searcher();
// Prepare models and fields to participate in search
$searcher->setFields([
'\Models\Auto' => [
'mark',
'model'
],
'\Models\Distributor' => [
'name',
'description'
]
])
->setQuery('FerRari');
$result = $searcher->run();
Filters
<?php
use \Searcher\Searcher;
// create object instance
$searcher = new Searcher();
// Prepare models and fields to participate in search
$searcher->setFields([
'\Models\Auto' => [
'mark',
'model'
],
'\Models\Distributor' => [
'name',
'description'
]
])
->setMin(3) // minimum char to query
->setMax(15) // maximum char to query
->setExact(true) // strict mode search
->setOrder(['\Models\Auto' => ['id' => 'DESC']]) // ORDER BY \Models\Auto.id DESC
->setGroup(['\Models\Distributor' => ['id']]) // GROUP BY \Models\Auto.id
->setThreshold(100) // LIMIT 100
->setQuery('FerRari');
$result = $searcher->run();
<?php
use \Searcher\Searcher;
// create object instance
$searcher = new Searcher();
// Prepare models and fields to participate in search
$searcher->setFields([
'\Models\Auto' => [
'mark',
'model'
],
'\Models\Distributor' => [
'name',
'description'
]
])
->setExact(true) // strict mode search
->setOrder([
'\Models\Auto' => ['id' => 'DESC']
'\Models\Distributor' => ['description' => 'ASC']
]) // ORDER BY \Models\Auto.id DESC, \Models\Distributor.description ASC
->setGroup([
'\Models\Auto' => ['id', 'mark']
'\Models\Distributor' => ['id', 'description']
]) // GROUP BY \Models\Auto.id, \Models\Auto.mark, \Models\Distributor.id, \Models\Distributor.description
->setThreshold([0,100]) // OFFSET 0, LIMIT 100
->setQuery('FerRari');
$result = $searcher->run();
Result modifiers and callbacks
<?php
use \Searcher\Searcher;
// create object instance
$searcher = new Searcher();
// Prepare models and fields to participate in search
$searcher->setFields([
'\Models\Auto' => [
'mark',
'model'
],
'\Models\Distributor' => [
'name',
'description'
]
])
->setQuery('FerRari');
$result = $searcher->run('json'); // available array, serialize, json, Resultset as default
// OR
/**
* @param $result
*/
$result = $searcher->run('array', function($result) {
//... any modifiers
return $result;
}); // available, array, serialize, json, Resultset as default
Unit Test
Also available in /phpunit directory. Run command to start
php build/phpunit.phar --configuration phpunit.xml.dist --coverage-text
Read logs from phpunit/log
##Issues
Screen (For what I use it?)

Related Skills
feishu-drive
351.2k|
things-mac
351.2kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
351.2kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
codebase-memory-mcp
1.3kHigh-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 66 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.



