Download the PHP package diezeel/laravel-sphinx without Composer
On this page you can find all versions of the php package diezeel/laravel-sphinx. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download diezeel/laravel-sphinx
More information about diezeel/laravel-sphinx
Files in diezeel/laravel-sphinx
Package laravel-sphinx
Short Description A Laravel query builder for SphinxQL
License MIT
Informations about the package laravel-sphinx
Sphinx Query Builder for Laravel
Laravel-Sphinx Database connector, providing an expressive query builder, Eloquent, ActiveRecord style ORM
- Config
- Usage
- Query Builder
- MATCH
- WITHIN GROUP, ORDER, OPTION
- Api SphinxConnection
- Resources
Installation
laravel-sphinx can be installed with Composer by adding it as a dependency to your project's composer.json file.
Please refer to Composer's documentation for more detailed installation and usage instructions.
Config
After updating composer, add the ServiceProvider to the providers array in config/app.php
Finally you can just add Sphinx Connection
to the database array in config/database.php
Usage
Get a connection and build queries
Using The Query Builder
Using The Eloquent ORM
Attribute Casting
For the results of the column attr_multi
can choose the format, which is converted to an array.
The values of '(1, 2, 3)'
for column type attr_multi
converted to an array [1, 2, 3]
Query Builder
For the build a query, using strong typing of values (how in SphinxQl).
Notice:
id = 1
andid = '1'
not the same
-
integer It is used to type integer
attr_uint
-
float It is used to type float
attr_float
-
bool (integer) It is used to type bool
attr_bool
, will be converted to integer (0 or 1) -
array (MVA) It is used to type MVA
attr_multi
- string - string values, escaped when requested
MATCH
-
$sq->match($column, $value, $half = false)
Search in full-text fields. Can be used multiple times in the same query. Column can be an array. Value can be an Expression to bypass escaping (and use your own custom solution).
For a function
match
used library SphinxQL::match
WITHIN GROUP, ORDER, OPTION
-
$sq->withinGroupOrderBy($column, $direction = 'ASC')
WITHIN GROUP ORDER BY $column [$direction]
Direction can be omitted with
null
, or beASC
orDESC
case insensitive. -
$sq->orderBy($column, $direction = null)
ORDER BY $column [$direction]
Direction can be omitted with
null
, or beASC
orDESC
case insensitive. -
$sq->option($name, $value)
OPTION $name = $value
Set a SphinxQL option such as
max_matches
orreverse_scan
for the query.
whereMulti
-
$sq->whereMulti($column, $operator, $values)
All parameters converted to a flat array
For the
in
andnot in
is different
Replace
- $sq->replace($values)
API SphinxConnection
- \Foolz\SphinxQL\Drivers\Pdo\Connection $db->getSphinxQLDriversConnection()
- \Foolz\SphinxQL\Helper $db->getSphinxQLHelper()
- \Foolz\SphinxQL\SphinxQL $db->createSphinxQL()