PHP code example of romeoz / rock-sphinx

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

    

romeoz / rock-sphinx example snippets


$rows =  (new \rock\sphinx\Query)
    ->from('items_idx')
    ->match($_POST['search'])
    ->all();

// find
$users = ItemsIndex::find()
    ->match($_POST['search'])
    ->all();
    
// insert to runtime index
$record = new RuntimeIndex;
$record->id = 15;
$record->name = 'Tom';
$users ->save();