Batch update given attributes in given documents
public updateAttributes ( string $index, array $attrs, array $values, boolean $mva = false ) : integer | ||
$index | string | search index |
$attrs | array | array of attribute names |
$values | array | hash of arrays of new attribute values keyed by document ID |
$mva | boolean | whether to treat attributes as MVAs |
Résultat | integer | Amount of updated documents (0 or more) on success, -1 on failure |
public function testUpdateAttributes() { $sphinx = new SphinxClient(); $sphinx->setGroupBy('attr1', SphinxClient::SPH_GROUPBY_ATTR); $sphinx->updateAttributes('sphinxtest', array('attr1'), array(1 => array(10), 2 => array(10), 3 => array(20), 4 => array(20))); $results = $sphinx->query('bb'); $this->assertEquals($results['total'], 3); // restore attributes $sphinx->updateAttributes('sphinxtest', array('attr1'), array(1 => array(2), 2 => array(4), 3 => array(1), 4 => array(5))); }
/** * {@inheritdoc} */ public function updateAttributes($index, array $attrs, array $values, $mva = false) { return $this->proxy->updateAttributes($index, $attrs, $values, $mva); }