• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Unset in finalizeRebuildSet()

digitalpoint

Well-known member
#1
Is the finalizeRebuildSet() method supposed to unset the entire $this->_bulkInserts property on every loop?

PHP:
	public function finalizeRebuildSet()
	{
		foreach ($this->_bulkInserts AS $contentType => $results)
		{
			$result = XenES_Api::indexBulk($this->_indexName, $contentType, $this->_bulkInserts[$contentType]);
			$this->_assertIndexSuccessful($result, $contentType);
			unset($this->_bulkInserts);
		}
		$this->_bulkInserts = array();
	}
Maybe it's supposed to be unsetting the array it's working on?

It ends up with a fatal error if you are bulk rebuilding multiple content types... This works:

PHP:
	public function finalizeRebuildSet()
	{
		foreach ($this->_bulkInserts AS $contentType => $results)
		{
			$result = XenES_Api::indexBulk($this->_indexName, $contentType, $this->_bulkInserts[$contentType]);
			$this->_assertIndexSuccessful($result, $contentType);
			unset($this->_bulkInserts[$contentType]);
		}
		$this->_bulkInserts = array();
	}