Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ciricihq/matchagainstbundle

A search bundle for symfony, using MySQL FULLTEXT MATCH AGAINST
https://github.com/ciricihq/matchagainstbundle

doctrine full-text full-text-search mysql symfony

Last synced: 5 days ago
JSON representation

A search bundle for symfony, using MySQL FULLTEXT MATCH AGAINST

Awesome Lists containing this project

README

        

MatchAgainstBundle
==================

Based on https://gist.github.com/ZeBigDuck/1234419

Installing
----------

```bash
composer require ciricihq/match-against-bundle
```

Usage
-----

You must load the bundle provided config.yml in order to have the
`MATCH_AGAINST` MySQL sentence

```yml
imports:
- { resource: ../../src/Cirici/MatchAgainstBundle/Resources/config/config.yml }
```

Make a query:

```php
$qbuilder
->select('sti.foreignId')
->from('Cirici\MatchAgainstBundle\Entity\SearchTextIndex', 'sti')
->where('sti.model = :entityClass')
->andWhere('sti.field = :fieldName')
// ->andWhere("MATCH_AGAINST(sti.content, :text 'IN NATURAL LANGUAGE MODE') > :score")
->andWhere("MATCH_AGAINST(sti.content, :text 'IN BOOLEAN MODE') > :score")
->setParameter('entityClass', $entity_class)
->setParameter('fieldName', $field_name)
->setParameter('text', $text)
->setParameter('score', $score)
;
```

License
-------

Licensed under the GNU GPL 2.0 license. Check out the `LICENSE` file for more
details.

Copyright 2015 © [Cirici New Media](http://cirici.com)