Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates Language Boost #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions classes/ezfezpsolrquerybuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1459,19 +1459,14 @@ protected function boostQuery()
$boostQuery = eZSolr::getMetaFieldName( 'installation_id' ) . ':' . eZSolr::installationID() . '^1.5';
$ini = eZINI::instance();

// Language boost. Only boost 3 first languages.
$languageBoostList = array( '1.2', '1.0', '0.8' );
foreach ( $ini->variable( 'RegionalSettings', 'SiteLanguageList' ) as $idx => $languageCode )
{
if ( empty( $languageBoostList[$idx] ) )
{
break;
}
$boostQuery .= ' ' . eZSolr::getMetaFieldName( 'language_code' ) . ':' . $languageCode . '^' . $languageBoostList[$idx];
}
// Get the default siteaccess language via the Locale ini setting
$locale = $ini->variable( 'RegionalSettings', 'Locale' );

// Boost only the default siteaccess language
$boostQuery .= ' ' . eZSolr::getMetaFieldName( 'language_code' ) . ':' . $locale . '^1.2';

// @TODO : User defined boosts through ini settings
return $boostQuery;
return trim($boostQuery);
}

/**
Expand Down