-
Notifications
You must be signed in to change notification settings - Fork 99
Open
Labels
Description
Add to FAQ / ReadME
class SBSearch {
...
... somewhere above is init() method
public static function createConnection()
{
$conn = new Connection();
$conn->setParams([
'host' => self::$sphinx_connection_host,
'port' => self::$sphinx_connection_port
]);
return (new SphinxQL($conn));
}
public static function rt_ReplaceIndex(string $index_name, array $updateset)
{
if (empty($updateset)) return null;
return self::createConnection()
->replace()
->into($index_name)
->set($updateset)
->execute();
}
...
I am adding data to my index.
$dataset = [
'id' => $id,
'title' => $item['title'],
'short' => $item['short'],
'text' => $item['text_bb'],
'date_added' => date_format( date_create_from_format('Y-m-d H:i:s', $item['cdate']), 'U' ),
'type' => 1,
'photo' => ((@$item['photo']['file'] != "") ? 1 : 0),
'author' => $item['author'],
'districts_all' => $item['districts_all'],
];
$status = SBSearch::rt_ReplaceIndex($sphinx_target_index, $dataset);
How to add MVA attribute 'rubrics' and 'districts'?
This fields described as
rt_attr_multi = rubrics
rt_attr_multi = districts
Easy:
'rubrics' => array_keys($item['rubrics']),
'districts' => array_keys($item['districts'])
Just send to dataset field ARRAY of values.
KarelWintersky