Get search result for all languages

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
ahmed31916
Advanced
Posts: 148
Joined: 14 Apr 2022, 12:15

Get search result for all languages

Post by ahmed31916 » 06 Jun 2022, 12:48

Hello,

How to get a result of all languages (not just current langaue)?

Code: Select all

$search->make( 'index.text:name', [app()->getLocale()]  )
Does, adding the star solve the problem?

Code: Select all

$search->make( 'index.text:name', ['*']  )

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

Re: Get search result for all languages

Post by aimeos » 07 Jun 2022, 16:16

Searching for product texts independent of a language is not available when using the index manager because the language ID is used here and it's mandatory:
https://github.com/aimeos/aimeos-core/b ... hp#L59-L66

You can overwrite the class and remove from "index.text:relevance" (MySQL example):

Code: Select all

public function getSearchAttributes( bool $withsub = true ) : array
{
	$level = \Aimeos\MShop\Locale\Manager\Base::SITE_ALL;
	$level = $this->context()->config()->get( 'mshop/index/manager/sitemode', $level );

	$expr = $this->siteString( 'mindte."siteid"', $level );

	$list = parent::getSearchAttributes( $withsub );
	$list['index.text:relevance']['internalcode'] = $this->siteString( 'mindte."siteid"', $level ) . ' AND MATCH( mindte."content" ) AGAINST( $2 IN BOOLEAN MODE )';
	
	return $list;
}
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply