Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pluk77/symfonysphinxbundle
Symfony bundle which provides integration of Sphinx or Manticore search engine with Symfony using SphinxQL
https://github.com/pluk77/symfonysphinxbundle
manticore manticore-search manticoresearch php sphinx sphinxql sphinxsearch symfony symfony-bundle symfony4 symfony5
Last synced: about 2 months ago
JSON representation
Symfony bundle which provides integration of Sphinx or Manticore search engine with Symfony using SphinxQL
- Host: GitHub
- URL: https://github.com/pluk77/symfonysphinxbundle
- Owner: pluk77
- License: other
- Fork: true (javer/JaverSphinxBundle)
- Created: 2018-12-13T08:43:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-18T06:49:50.000Z (almost 4 years ago)
- Last Synced: 2024-09-23T16:21:36.513Z (about 2 months ago)
- Topics: manticore, manticore-search, manticoresearch, php, sphinx, sphinxql, sphinxsearch, symfony, symfony-bundle, symfony4, symfony5
- Language: PHP
- Homepage:
- Size: 47.9 KB
- Stars: 5
- Watchers: 2
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
SymfonySphinxBundle
=================Forked from javer/JaverSphinxBundle
This bundle provides integration of [Sphinx](http://sphinxsearch.com) or [Manticore](https://manticoresearch.com/) search engine with Symfony4+.
Features:
- SphinxQL Query Builder
- Integration with [doctrine/orm](https://packagist.org/packages/doctrine/orm)
- Symfony Profiler toolbar section with number of executed queries and profiler page with detailed information about executed queriesThis fork is not backwards compatible with Javer/JaverSphinxBundle
Requirements
------------- PHP 7.1+
- pdo_mysql php extension
- Symfony 4+Installation
------------Install the bundle using composer:
```sh
composer require pluk77/symfony-sphinx-bundle
```Configuration
-------------Add to your ```config/package/symfony_sphinx.yml``` the following options:
```yml
symfony_sphinx:
host: 127.0.0.1
port: 9306
```Full configuration with default values:
```yml
symfony_sphinx:
host: 127.0.0.1
port: 9306
```Usage
-----Synthetic example of SELECT query which returns an array:
```php
$results = $sphinx->createQuery()
->select('id', 'column1', 'column2', 'WEIGHT() as weight')
->from(['index1', 'index2'])
->where('column3', 'value1')
->andWhere('column4', '>', 4)
->andWhere('column5', [5, '6'])
->andWhere('column6', 'NOT IN', [7, '8'])
->andWhere('column7', 'BETWEEN', [9, 10])
->match('column8', 'value2')
->andMatch(['column9', 'column10'], 'value3')
->orMatch(['column9', 'column10'], 'value3')
->rawMatch('(@(first_name,alias_first_name) hello* | @first_name john)')
->orRawMatch('(@(first_name,alias_first_name) hello* | @first_name john)')
->andRawMatch('(@(first_name,alias_first_name) hello* | @first_name john)')
->groupBy('column11')
->andGroupBy('column12')
->withinGroupOrderBy('column13', 'desc')
->AndWithinGroupOrderBy('column14')
->having('weight', '>', 2)
->orderBy('column15', 'desc')
->andOrderBy('column16')
->setFirstResult(5)
->setMaxResults(10)
->setOption('agent_query_timeout', 10000)
->addOption('max_matches', 1000)
->addOption('field_weights', '(column9=10, column10=3)')
->getResults();
```Entities fetched from the database using Doctrine ORM QueryBuilder by searching phrase in them using Sphinx:
```php
$queryBuilder = $this->getRepository(Patient::class)
->createQueryBuilder('p')
->select();$query = $sphinx->createQuery()
->select('id')
->from('patient')
->match(['last_name','first_name'], 'jo*')
->setOption('field_weights', '(last_name=10, first_name=5)')
->useQueryBuilder($queryBuilder, 'p', 'id');
$results = $query->getResults();```