CirrusSearch
Elasticsearch-powered search for MediaWiki
Loading...
Searching...
No Matches
CirrusSearch\Extra\MultiList\MultiListBuilder Class Reference

Utility class for encoding weighted tags. More...

Static Public Member Functions

static buildWeightedTagsFromLegacyParameters (string $tagPrefix, $tagNames=null, $tagWeights=null)
 
static buildWeightedTags (string $tagPrefix, ?array $tagWeightsByName=null)
 
static buildTagWeightsFromLegacyParameters ( $tagNames=null, $tagWeights=null)
 Merges $tagNames and $tagWeights into a single map that can be passed to buildWeightedTags.
 

Detailed Description

Utility class for encoding weighted tags.

See also
https://wikitech.wikimedia.org/wiki/Search/WeightedTags

Member Function Documentation

◆ buildTagWeightsFromLegacyParameters()

static CirrusSearch\Extra\MultiList\MultiListBuilder::buildTagWeightsFromLegacyParameters ( $tagNames = null,
$tagWeights = null )
static

Merges $tagNames and $tagWeights into a single map that can be passed to buildWeightedTags.

Parameters
null | string | string[]$tagNamesOptional tag name or list of tag names. Each tag will be set for each target ID. Omit for tags which are fully defined by their prefix.
null | int | int[]$tagWeightsOptional tag weight(s).
  • If $tagNames is null, an integer.
  • Otherwise, a [ tagName => weight ] map. This may only use a subset of $tagNames as keys.
  • However, only valid keys (which exist in $tagNames) will result in returned tags.

A single weight ranges between 1-1000.

Returns
null[]|int[] A map of tag weights keyed by tag name
See also
buildWeightedTags
buildWeightedTagsFromLegacyParameters

◆ buildWeightedTags()

static CirrusSearch\Extra\MultiList\MultiListBuilder::buildWeightedTags ( string $tagPrefix,
?array $tagWeightsByName = null )
static
Parameters
string$tagPrefixA prefix shared by all $tagNames
null | null[] | int[]$tagWeightsByNameOptional tag weights. A map of optional weights, keyed by tag name. Omit for tags which are fully defined by their prefix. A single weight ranges between 1-1000.
Returns
MultiListWeightedTag[]

◆ buildWeightedTagsFromLegacyParameters()

static CirrusSearch\Extra\MultiList\MultiListBuilder::buildWeightedTagsFromLegacyParameters ( string $tagPrefix,
$tagNames = null,
$tagWeights = null )
static
Parameters
string$tagPrefixA prefix shared by all $tagNames
string | string[] | null$tagNamesOptional tag name or list of tag names. Each tag will be set for each target ID. Omit for tags which are fully defined by their prefix.
int | int[] | null$tagWeightsOptional tag weight(s).
  • If $tagNames is null, an integer.
  • Otherwise, a [ tagName => weight ] map. This may only use a subset of $tagNames as keys. However, only valid keys (which exist in $tagNames) will result in returned tags.

A single weight ranges between 1-1000.

Returns
MultiListWeightedTag[]
Deprecated
use buildWeightedTags instead use buildTagWeightsFromLegacyParameters to migrate

The documentation for this class was generated from the following file: