Making WordPress.org

Changeset 13749


Ignore:
Timestamp:
05/23/2024 02:53:11 AM (3 weeks ago)
Author:
dd32
Message:

Plugin Directory: Search: Weight the english plugin title higher for localised searches.

Most locales don't translate the WordPress.org readme.txt name field, and most don't alter the title at all.

When a locale doesn't translate this field (even as a 1:1 match) this results in plugins often being unable to be found by title.

This changes the weighting for the english search title from 0.00001 to 0.5 which results in the localised title being preferred, but should result in english matches still ranking in the results.

See https://wordpress.org/support/topic/what-happened-to-the-plugin-search-system/
See #6106, #7617.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-search.php

    r13687 r13749  
    2222    protected $desc_boost      = 1;
    2323    protected $desc_en_boost   = 0.00001;
     24    protected $title_boost     = 1;
     25    protected $title_en_boost  = 0.5;
    2426
    2527    /**
     
    173175                $boost = '^' . $this->desc_boost;
    174176                $en_boost = '^' . $this->desc_en_boost;
     177            } elseif ( 'title' === $field ) {
     178                $boost = '^' . $this->title_boost;
     179                $en_boost = '^' . $this->title_en_boost;
    175180            }
    176181
     
    205210        $this->desc_en_boost        = $this->desc_boost * $this->en_boost;
    206211
     212        // Most locales don't translate the title, so we only need to boost the title slightly lower.
     213        $this->title_en_boost       = $this->title_boost * 0.5;
     214
    207215        // We need to be locale aware for this
    208216        $this->locale     = get_locale();
     
    353361                'filter' => [
    354362                    'range' => [
    355                             'active_installs' => [
    356                                 'lte' => 1000000,
    357                             ],
     363                        'active_installs' => [
     364                            'lte' => 1000000,
    358365                        ],
    359366                    ],
     367                ],
    360368                'exp' => [
    361369                    'active_installs' => [
Note: See TracChangeset for help on using the changeset viewer.