Не могу понять что нужно передать в
/path/to/index/files/
Код: Выделить всё
use yii\sphinx\Query;
$query = new Query;
$rows = $query->from('idx_item')
->match($_POST['search'])
->snippetCallback(function ($rows) {
$result = [];
foreach ($rows as $row) {
$result[] = file_get_contents('/path/to/index/files/' . $row['id'] . '.txt');
}
return $result;
})
->all();
foreach ($rows as $row) {
echo $row['snippet'];
}