public function rebuildIndex( array $items = array() )
	{
		$context = $this->_getContext();
		$config = $context->getConfig();

		$size = $config->get( 'mshop/catalog/manager/index/default/chunksize', 1000 );
		$mode = $config->get( 'mshop/catalog/manager/index/default/index', 'categorized' );

		$default = array( 'attribute', 'price', 'text', 'product' );
		$domains = $config->get( 'mshop/catalog/manager/index/default/domains', $default );

		$manager = MShop_Factory::createManager( $context, 'product' );
		$search = $manager->createSearch( true );
		$search->setSortations( array( $search->sort( '+', 'product.id' ) ) );
		$defaultConditions = $search->getConditions();

		$paramIds = array();
		foreach( $items as $item ) {
			$paramIds[] = $item->getId();
		}

		if( $mode === 'all' ) // index all product items
		{
			if( !empty( $paramIds ) )
			{
				$expr = array(
					$search->compare( '==', 'product.id', $paramIds ),
					$defaultConditions,
				);
				$search->setConditions( $search->combine( '&&', $expr ) );
			}

			$this->_writeIndex( $search, $domains, $size );
			return;
		}

		// index categorized product items only
		$catalogListManager = MShop_Factory::createManager( $context, 'catalog/list' );
		$catalogSearch = $catalogListManager->createSearch( true );

		$expr = array( $catalogSearch->compare( '==', 'catalog.list.domain', 'product' ) );

		if( !empty( $paramIds ) ) {
			$expr[] = $catalogSearch->compare( '==', 'catalog.list.refid', $paramIds );
		}

		$expr[] = $catalogSearch->getConditions();

		$catalogSearch->setConditions( $catalogSearch->combine( '&&', $expr ) );
		$catalogSearch->setSortations( array( $catalogSearch->sort( '+', 'catalog.list.refid' ) ) );

		$start = 0;

		do
		{
			$catalogSearch->setSlice( $start, $size );
			$result = $catalogListManager->aggregate( $catalogSearch, 'catalog.list.refid' );

			$expr = array(
				$search->compare( '==', 'product.id', array_keys( $result ) ),
				$defaultConditions,
			);
			$search->setConditions( $search->combine( '&&', $expr ) );

			$this->_writeIndex( $search, $domains, $size );

			$start += $size;
		}
		while( count( $result ) > 0 );
	}