2017 © Pedro Peláez
 

library sphinxsearch

Laravel package to query Sphinxsearch in Laravel 5 Lumen

image

wneuteboom/sphinxsearch

Laravel package to query Sphinxsearch in Laravel 5 Lumen

  • Wednesday, October 25, 2017
  • by WNeuteboom
  • Repository
  • 1 Watchers
  • 0 Stars
  • 388 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 48 Forks
  • 0 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

Sphinx Search for Laravel 5 Lumen

Simple Laravel 5 Lumen package for make queries to Sphinx Search. Forked from sngrl/sphinxsearch package for Laravel 5., (*1)

This package was created to import to the site packagist.org and allow installation through Composer (https://getcomposer.org/)., (*2)

Installation

Require this package in your composer.json:, (*3)

    "require": {
        /*** Some others packages ***/
        "wneuteboom/sphinxsearch": "dev-master",
    },

Run in your console composer update command to pull down the latest version of Sphinx Search., (*4)

Or just run this in console:, (*5)

composer require wneuteboom/sphinxsearch-lumen:dev-master

After updating composer, add the ServiceProvider to the "providers" array in config/app.php:, (*6)

    'providers' => array(
        /*** Some others providers ***/
        WNeuteboom\SphinxSearch\SphinxSearchServiceProvider::class,
    ),

You can add this line to the files, where you may use SphinxSearch:, (*7)

use WNeuteboom\SphinxSearch;

Configuration

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., (*8)

php artisan vendor:publish --provider=WNeuteboom\SphinxSearch\SphinxSearchServiceProvider --force

This will create the file config/sphinxsearch.php. Modify as needed the host and port., (*9)

return array (
    'host'    => '127.0.0.1',
    'port'    => 9312,
    'timeout' => 30
);

Usage

Basic query (raw sphinx results), (*10)

$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), (*11)

$sphinx = new SphinxSearch;
$sphinx
    ->index('products')
    ->select('id, name')
    ->table(\App\SpecificModel)
    ->weights([
        'name' => 1
    ])
    ->search("string to search")
    ->skip(0)
    ->take(100)
    ->get();

License

WNeuteboom Sphinx Search is open-sourced software licensed under the MIT license, (*12)

The Versions

25/10 2017

dev-master

9999999-dev http://github.com/WNeuteboom/sphinxsearch

Laravel package to query Sphinxsearch in Laravel 5 Lumen

  Sources   Download

Apache-2.0

The Requires

 

by W. Neuteboom

laravel laravel 5 sphinx sphinxsearch lavavel 5 lumen