Package Data | |
---|---|
Maintainer Username: | zhukovra |
Maintainer Contact: | w.neuteboom@slashforward.nl (W. Neuteboom) |
Package Create Date: | 2017-07-05 |
Package Last Update: | 2017-10-25 |
Language: | PHP |
License: | Apache-2.0 |
Last Refreshed: | 2024-11-24 03:00:32 |
Package Statistics | |
---|---|
Total Downloads: | 16 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 1 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Simple Laravel 5 Lumen package for make queries to Sphinx Search. Forked from sngrl/sphinxsearch package for Laravel 5.
This package was created to import to the site packagist.org and allow installation through Composer (https://getcomposer.org/).
Require this package in your composer.json:
"require": {
/*** Some others packages ***/
"wneuteboom/sphinxsearch": "dev-master",
},
Run in your console composer update
command to pull down the latest version of Sphinx Search.
Or just run this in console:
composer require wneuteboom/sphinxsearch-lumen:dev-master
After updating composer, add the ServiceProvider to the "providers" array in config/app.php:
'providers' => array(
/*** Some others providers ***/
WNeuteboom\SphinxSearch\SphinxSearchServiceProvider::class,
),
You can add this line to the files, where you may use SphinxSearch:
use WNeuteboom\SphinxSearch;
To use Sphinx Search, you need to configure your indexes and what model it should query. To do so, publish the configuration into your app.
php artisan vendor:publish --provider=WNeuteboom\SphinxSearch\SphinxSearchServiceProvider --force
This will create the file config/sphinxsearch.php
. Modify as needed the host and port.
return array (
'host' => '127.0.0.1',
'port' => 9312,
'timeout' => 30
);
Basic query (raw sphinx results)
$sphinx = new SphinxSearch();
$sphinx
->index('products')
->select('id, name')
->weights([
'name' => 1
])
->search("string to search")
->skip(0)
->take(100)
->get();
Basic query (with Eloquent)
$sphinx = new SphinxSearch;
$sphinx
->index('products')
->select('id, name')
->table(\App\SpecificModel)
->weights([
'name' => 1
])
->search("string to search")
->skip(0)
->take(100)
->get();
WNeuteboom Sphinx Search is open-sourced software licensed under the MIT license