- Issue created by @farse
- π¬π§United Kingdom farse
I have created a patch for this issue.
I was then able to make a custom processor to use preprocessSearchQuery to add in the multiple boosts. My example:public function preprocessSearchQuery(QueryInterface $query) { parent::preprocessSearchQuery($query); // Get the current user's current language. $current_language = $this->languageManager->getCurrentLanguage()->getId(); // Define the language priority order. $language_priority = [ 'en' => 6, 'fr' => 5, 'es' => 4, 'ar' => 3, 'zh-hans' => 2, 'ru' => 1, ]; $language_priority[$current_language] = 8; // Add a boost based on the langcode field. foreach ($language_priority as $langcode => $boost) { $query_boost[$langcode] = sprintf('if(eq(%s,"%s"),%2F,0.0)', SolrBackendInterface::FIELD_PLACEHOLDER, $langcode, $boost); } // Works now with search_api_solr_multiple_boost_per_field_3492868_3.patch. $boosts['search_api_language'] = $query_boost; $query->setOption('solr_document_boost_factors', $boosts); }
- π©πͺGermany mkalkbrenner π©πͺ
I don't think that we should add that workaround to search_api_solr.
The feature request should target search_api first to allow multiple boosts.
Then the backends should be adjusted accordingly. - πΊπΈUnited States DamienMcKenna NH, USA
Is this a duplicate of π¬ Boosting is limited to one boost per field Active ?