def UpdateAttributes ( self, index, attrs, values, mva=False, ignorenonexistent=False ):
		"""
		Update given attribute values on given documents in given indexes.
		Returns amount of updated documents (0 or more) on success, or -1 on failure.

		'attrs' must be a list of strings.
		'values' must be a dict with int key (document ID) and list of int values (new attribute values).
		optional boolean parameter 'mva' points that there is update of MVA attributes.
		In this case the 'values' must be a dict with int key (document ID) and list of lists of int values
		(new MVA attribute values).
		Optional boolean parameter 'ignorenonexistent' points that the update will silently ignore any warnings about
		trying to update a column which is not exists in current index schema.

		Example:
			res = cl.UpdateAttributes ( 'test1', [ 'group_id', 'date_added' ], { 2:[123,1000000000], 4:[456,1234567890] } )
		"""
		assert ( isinstance ( index, str ) )
		assert ( isinstance ( attrs, list ) )
		assert ( isinstance ( values, dict ) )
		for attr in attrs:
			assert ( isinstance ( attr, str ) )
		for docid, entry in list(values.items()):
			AssertUInt32(docid)
			assert ( isinstance ( entry, list ) )
			assert ( len(attrs)==len(entry) )
			for val in entry:
				if mva:
					assert ( isinstance ( val, list ) )
					for vals in val:
						AssertInt32(vals)
				else:
					AssertInt32(val)

		# build request
		req = bytearray()
		index = str_bytes(index)
		req.extend( pack('>L',len(index)) + index )

		req.extend ( pack('>L',len(attrs)) )
		ignore_absent = 0
		if ignorenonexistent: ignore_absent = 1
		req.extend ( pack('>L', ignore_absent ) )
		mva_attr = 0
		if mva: mva_attr = 1
		for attr in attrs:
			attr = str_bytes(attr)
			req.extend ( pack('>L',len(attr)) + attr )
			req.extend ( pack('>L', mva_attr ) )

		req.extend ( pack('>L',len(values)) )
		for docid, entry in list(values.items()):
			req.extend ( pack('>Q',docid) )
			for val in entry:
				val_len = val
				if mva: val_len = len ( val )
				req.extend ( pack('>L',val_len ) )
				if mva:
					for vals in val:
						req.extend ( pack ('>L',vals) )

		# connect, send query, get response
		sock = self._Connect()
		if not sock:
			return None

		length = len(req)
		req_all = bytearray()
		req_all.extend( pack ( '>2HL', SEARCHD_COMMAND_UPDATE, VER_COMMAND_UPDATE, length ) )
		req_all.extend( req )
		self._Send ( sock, req_all )

		response = self._GetResponse ( sock, VER_COMMAND_UPDATE )
		if not response:
			return -1

		# parse response
		updated = unpack ( '>L', response[0:4] )[0]
		return updated

		Update given attribute values on given documents in given indexes.
		Returns amount of updated documents (0 or more) on success, or -1 on failure.

		'attrs' must be a list of strings.
		'values' must be a dict with int key (document ID) and list of int values (new attribute values).
		optional boolean parameter 'mva' points that there is update of MVA attributes.
		In this case the 'values' must be a dict with int key (document ID) and list of lists of int values
		(new MVA attribute values).
		Optional boolean parameter 'ignorenonexistent' points that the update will silently ignore any warnings about
		trying to update a column which is not exists in current index schema.

		Example:
			res = cl.UpdateAttributes ( 'test1', [ 'group_id', 'date_added' ], { 2:[123,1000000000], 4:[456,1234567890] } )
		
plugins/sphinx/class/sphinxapi.py