PHP code example of mediashowroom / sphinxsearch-bundle

1. Go to this page and download the library: Download mediashowroom/sphinxsearch-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/ */

    

mediashowroom / sphinxsearch-bundle example snippets

 php
$indexesToSearch = array('Items');
$sphinxSearch = $this->get('search.sphinxsearch.search');
$searchResults = $sphinxSearch->search('search query', $indexesToSearch);
 php
$indexesToSearch = array('Items');
$options = array(
  'result_offset' => 0,
  'result_limit' => 25,
  'field_weights' => array(
    'Name' => 2,
    'SKU' => 3,
  ),
);
$sphinxSearch = $this->get('search.sphinxsearch.search');
$sphinxSearch->setMatchMode(SPH_MATCH_EXTENDED2);
$sphinxSearch->setFilter('disabled', array(1), true);
$searchResults = $sphinxSearch->search('search query', $indexesToSearch, $options);