public function rebuildIndex( array $items = array() )
	{
		if( empty( $items ) ) { return; }

		MW_Common_Abstract::checkClassList( 'MShop_Product_Item_Interface', $items );

		$context = $this->_getContext();
		$locale = $context->getLocale();
		$siteid = $context->getLocale()->getSiteId();
		$editor = $context->getEditor();
		$date = date( 'Y-m-d H:i:s' );


		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			foreach( $items as $item )
			{
				$parentId = $item->getId(); // array id != $item->getId() for sub-products

				$listTypes = array();
				foreach( $item->getListItems( 'text' ) as $listItem ) {
					$listTypes[ $listItem->getRefId() ][] = $listItem->getType();
				}

				$stmt = $this->_getCachedStatement( $conn, 'mshop/catalog/manager/index/text/default/item/insert' );

				foreach( $item->getRefItems( 'text' ) as $refId => $refItem )
				{
					if( !isset( $listTypes[$refId] ) ) {
						$msg = sprintf( 'List type for text item with ID "%1$s" not available', $refId );
						throw new MShop_Catalog_Exception( $msg );
					}

					foreach( $listTypes[$refId] as $listType )
					{
						$this->_saveText(
							$stmt, $parentId, $siteid, $refId, $refItem->getLanguageId(), $listType,
							$refItem->getType(), 'product', $refItem->getContent(), $date, $editor
						);
					}
				}

				$names = $item->getRefItems( 'text', 'name' );

				if( empty( $names ) )
				{
					$this->_saveText(
						$stmt, $parentId, $siteid, null, $locale->getLanguageId(), 'default',
						'name', 'product', $item->getLabel(), $date, $editor
					);
				}
			}

			$dbm->release( $conn, $dbname );

		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}

		$this->_saveAttributeTexts( $items );

		foreach( $this->_getSubManagers() as $submanager ) {
			$submanager->rebuildIndex( $items );
		}
	}
public function rebuildIndex( array $items = array() )
	{
		if( empty( $items ) ) { return; }

		MW_Common_Abstract::checkClassList( 'MShop_Product_Item_Interface', $items );

		$context = $this->_getContext();
		$locale = $context->getLocale();
		$siteid = $context->getLocale()->getSiteId();
		$editor = $context->getEditor();
		$date = date( 'Y-m-d H:i:s' );


		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			foreach( $items as $item )
			{
				$parentId = $item->getId(); // array id != $item->getId() for sub-products

				$listTypes = array();
				foreach( $item->getListItems( 'text' ) as $listItem ) {
					$listTypes[ $listItem->getRefId() ][] = $listItem->getType();
				}

				$stmt = $this->_getCachedStatement( $conn, 'mshop/catalog/manager/index/text/default/item/insert' );

				foreach( $item->getRefItems( 'text' ) as $refId => $refItem )
				{
					if( !isset( $listTypes[$refId] ) ) {
						$msg = sprintf( 'List type for text item with ID "%1$s" not available', $refId );
						throw new MShop_Catalog_Exception( $msg );
					}

					foreach( $listTypes[$refId] as $listType )
					{
						$this->_saveText(
							$stmt, $parentId, $siteid, $refId, $refItem->getLanguageId(), $listType,
							$refItem->getType(), 'product', $refItem->getContent(), $date, $editor
						);
					}
				}

				$names = $item->getRefItems( 'text', 'name' );

				if( empty( $names ) )
				{
					$this->_saveText(
						$stmt, $parentId, $siteid, null, $locale->getLanguageId(), 'default',
						'name', 'product', $item->getLabel(), $date, $editor
					);
				}
			}

			$dbm->release( $conn, $dbname );

		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}

		$this->_saveAttributeTexts( $items );

		foreach( $this->_getSubManagers() as $submanager ) {
			$submanager->rebuildIndex( $items );
		}
	}
public function rebuildIndex ( array $ items = array ( ) ) { if ( empty ( $ items ) ) { return ; } MW_Common_Abstract :: checkClassList ( 'MShop_Product_Item_Interface' , $ items ) ; $ context = $ this -> _getContext ( ) ; $ locale = $ context -> getLocale ( ) ; $ siteid = $ context -> getLocale ( ) -> getSiteId ( ) ; $ editor = $ context -> getEditor ( ) ; $ date = date ( 'Y-m-d H:i:s' ) ; $ dbm = $ context -> getDatabaseManager ( ) ; $ dbname = $ this -> _getResourceName ( ) ; $ conn = $ dbm -> acquire ( $ dbname ) ; try { foreach ( $ items as $ item ) { $ parentId = $ item -> getId ( ) ; // array id != $item->getId() for sub-products $ listTypes = array ( ) ; foreach ( $ item -> getListItems ( 'text' ) as $ listItem ) { $ listTypes [ $ listItem -> getRefId ( ) ] [ ] = $ listItem -> getType ( ) ; } $ stmt = $ this -> _getCachedStatement ( $ conn , 'mshop/catalog/manager/index/text/default/item/insert' ) ; foreach ( $ item -> getRefItems ( 'text' ) as $ refId => $ refItem ) { if ( ! isset ( $ listTypes [ $ refId ] ) ) { $ msg = sprintf ( 'List type for text item with ID "%1$s" not available' , $ refId ) ; throw new MShop_Catalog_Exception ( $ msg ) ; } foreach ( $ listTypes [ $ refId ] as $ listType ) { $ this -> _saveText ( $ stmt , $ parentId , $ siteid , $ refId , $ refItem -> getLanguageId ( ) , $ listType , $ refItem -> getType ( ) , 'product' , $ refItem -> getContent ( ) , $ date , $ editor ) ; } } $ names = $ item -> getRefItems ( 'text' , 'name' ) ; if ( empty ( $ names ) ) { $ this -> _saveText ( $ stmt , $ parentId , $ siteid , null , $ locale -> getLanguageId ( ) , 'default' , 'name' , 'product' , $ item -> getLabel ( ) , $ date , $ editor ) ; } } $ dbm -> release ( $ conn , $ dbname ) ; } catch ( Exception $ e ) { $ dbm -> release ( $ conn , $ dbname ) ; throw $ e ; } $ this -> _saveAttributeTexts ( $ items ) ; foreach ( $ this -> _getSubManagers ( ) as $ submanager ) { $ submanager -> rebuildIndex ( $ items ) ; } }
Rebuilds the catalog index text for searching products or specified list of products.
This can be a long lasting operation.

@param MShop_Common_Item_Interface[] $items Associative list of product IDs and items implementing MShop_Product_Item_Interface
Rebuilds the catalog index text for searching products or specified list of products . This can be a long lasting operation .