Type boosting no longer works with Search API 4.3.x

Created on 20 September 2023, 9 months ago
Updated 29 September 2023, 9 months ago

Problem/Motivation

Has anyone already tested the boosting functions with the new Search API 4.3.x version?

Apparently, it doesn't work as well as before for defined terms.

My setting for the type-specific boosting was: default 13.0, custom content type bundle 21.00... so the maximum that is possible.

For the content fields themselves, for my Solr index I use the type Fulltext "ngram", with a moderate boost: title boost 3.00, lead text 2.00 and text (paragraphs) 1.00.

Since the upgrade to Search API 4.3.0, however, my terms are not boosted as they were with 4.2.0, they usually appear somewhere in the middle and no longer on top, or are not displayed at all.

With the new Search API version, a few things have indeed changed, should something possibly also be adjusted here in the module?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.1

Component

Miscellaneous

Created by

🇩🇪Germany zcht

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @zcht
  • 🇩🇪Germany mkalkbrenner 🇩🇪

    We have test coverage for boosting and sort by relevance.
    And some bigger installations run on the 4.3.0 code base since two more than a month without such issues.

    But it is essential that you re-create the core (or the collection in case of Solr Cloud) using the configsset.

  • 🇩🇪Germany mkalkbrenner 🇩🇪

    This module needs to implement EventSubscribers instead of hooks. These will work with 4.2 and 4.3.

  • First commit to issue fork.
  • @mandclu opened merge request.
  • Status changed to Needs review 9 months ago
  • 🇨🇦Canada mandclu

    I followed the instructions in this guide page to move the logic into an EventSubscriber, and also added a composer.json file to specify the version of search_api_solr that is needed.

    I haven't actually had a chance to test this yet, so any feedback is appreciated.

  • Status changed to Needs work 9 months ago
  • 🇩🇪Germany zcht

    Thanks for the analysis and the patch, which unfortunately does not quite work for me yet. My setup looks like this: Drupal 10.1.4, Search API 4.3.x, PHP 8.1.x, nginx. The patch is applied cleanly, however after reindexing the index, the search results (filtered by relevance) are not output, which are configured with Search Overrides.

    In detail, when viewing and e.g. a cache clear via drush cr, the following error message comes up, this actually only occurs when the patch is applied. Without the patch, everything works normally, except for the search overrides of course. It is true that I did not test it with a fresh installation, but directly in my project to have some database and simulate the productive environment.

    In CheckDefinitionValidityPass.php line 61:
    
      The definition for "tags" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.
    Symfony\Component\DependencyInjection\Exception\RuntimeException: The definition for "tags" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error. in Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass->process() (line 61 of /var/www/html/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php).
    Symfony\Component\DependencyInjection\Compiler\Compiler->compile(Object) (Line: 767)
    Symfony\Component\DependencyInjection\ContainerBuilder->compile() (Line: 1335)
    Drupal\Core\DrupalKernel->compileContainer() (Line: 934)
    Drupal\Core\DrupalKernel->initializeContainer() (Line: 1186)
    Drupal\Core\DrupalKernel->rebuildContainer() (Line: 503)
    drupal_flush_all_caches() (Line: 205)
    Drupal\admin_toolbar_tools\Controller\ToolbarController->flushAll()
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)
    Drupal\remove_http_headers\StackMiddleware\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
  • Status changed to Needs review 9 months ago
  • 🇨🇦Canada mandclu

    Apologies for that. Looks like it was a YAML problem in the services.yml file. Please try it again.

  • Status changed to RTBC 9 months ago
  • 🇩🇪Germany zcht

    Thanks for the update: yes, looks good now, no errors, the results on production with Search API 4.2.x resemble the Search API 4.3.x with the patch. Everything seems to work fine.

    So from my side gladly a RTBC++

    • mandclu committed 267da23f on 2.1.x
      Issue #3388417: Type boosting no longer works with Search API 4.3.x
      
  • Status changed to Fixed 9 months ago
  • 🇨🇦Canada mandclu

    Great! Merged this in, and will roll a new release shortly.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024