how to

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
mahammadareef
Posts: 54
Joined: 14 Oct 2022, 11:54

how to

Post by mahammadareef » 13 Feb 2023, 11:29

I have added 'ai-catsuggest' package to aimeos and I wanted to modify my existing keyword table (mshop_keyword) by adding a FULLTEXT index column so I wanted to create a Keywordindex.php file exactly like the SupplierIndex.php file located in vendor/aimeos/ai-catsuggest/setup/Supplierindex.php

help me on this

Thanks in advance

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: how to

Post by aimeos » 15 Feb 2023, 08:02

Just copy the file to your ./setup directory and modify it:

Code: Select all

<?php


namespace Aimeos\Upscheme\Task;


class KeywordIndex extends Base
{
	public function after() : array
	{
		return ['Product'];
	}


	public function up()
	{
		$db = $this->db( 'db-keyword' );

		if( !$db->hasIndex( 'mshop_keyword', 'idx_mskey_label' ) )
		{
			$this->info( 'Creating keyword fulltext index', 'vv' );

			$db->for( 'mysql', 'CREATE FULLTEXT INDEX `idx_mskey_label` ON `mshop_keyword` (`label`)' );

			try {
				$db->for( 'postgresql', 'CREATE INDEX "idx_mskey_label" ON "mshop_keyword" USING GIN (to_tsvector(\'english\', "label"))' );
			} catch( \Exception $e ) {
				// Doctrine DBAL bug: https://github.com/doctrine/dbal/issues/5351
			}
		}
	}
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply