PHP code example of scorpio / sphinx-search-bundle
1. Go to this page and download the library: Download scorpio/sphinx-search-bundle 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/ */
scorpio / sphinx-search-bundle example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Scorpio\SphinxSearchBundle\ScorpioSphinxSearchBundle(),
// ...
);
}
class MyController extends Controller
{
function indexAction(Request $request)
{
// bind a search term somehow, apply filters etc. maybe check for keywords...
$query = $this
->get('query.my_custom_sphinx_index')
->setQuery($request->query->get('keywords'));
$results = $this->get('scorpio_sphinx_search.search_manager')->query($query);
// do something with the results.
}
}