I think it is common practice across all search frameworks that item scores (or relevancy, …) and boosts can only be non-negative numbers. However, we never specify that in the Search API framework, even though some of the code (e.g., the Database backend) implicitly assumes it. We now even got a bug report (#3484686: Error when trying to boost on numeric field with negative value) where indexing failed because of this.

We should officially declare that scores and boosts are non-negative and deprecate setting negative score/boost values in preparation of failing directly on them (probably with a RuntimeException so it doesn’t need to be caught).

Issue fork search_api-3485260

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

drunken monkey created an issue. See original summary.

drunken monkey’s picture

Status: Active » Needs review

Created a change record and an MR.

drunken monkey’s picture

Status: Needs review » Fixed

Merged.

  • drunken monkey committed 4c164be8 on 8.x-1.x
    Issue #3485260 by drunken monkey: Deprecated negative item scores/boosts...

Status: Fixed » Closed (fixed)

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