PHP code example of biblioonline / sphinxsearch-l5

1. Go to this page and download the library: Download biblioonline/sphinxsearch-l5 library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

biblioonline / sphinxsearch-l5 example snippets


	"       /*** Some others packages ***/
		"sngrl/sphinxsearch": "dev-master",
	},

composer 

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

use sngrl\SphinxSearch\SphinxSearch;

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

return array (
	'host'    => '127.0.0.1',
	'port'    => 9312,
	'indexes' => array (
		'my_index_name' => array ( 'table' => 'my_keywords_table', 'column' => 'id' ),
	)
);

return array (
	'host'    => '127.0.0.1',
	'port'    => 9312,
	'indexes' => array (
		'my_index_name' => FALSE,
	)
);

$sphinx = new SphinxSearch();
$results = $sphinx->search('my query', 'index_name')->query();

$results = $sphinx->search('my query', 'index_name')->get();

$results = $sphinx->search('my query', 'index_name')
	->limit(30)
	->filter('attribute', array(1, 2))
	->range('int_attribute', 1, 10)
	->get();

$result = $sphinx->search('my query', 'index_name')
	->setFieldWeights(
		array(
			'partno'  => 10,
			'name'    => 8,
			'details' => 1
		)
	)
	->setMatchMode(\Sphinx\SphinxClient::SPH_MATCH_EXTENDED)
	->setSortMode(\Sphinx\SphinxClient::SPH_SORT_EXTENDED, "@weight DESC")
	->get(true);  //passing true causes get() to respect returned sort order