Create a plugin manager for creating rankings.

Created on 3 October 2025, 19 days ago

Problem/Motivation

The current event subscriber has a hard coded ranking/query implementation. It would be ideal to instead call a custom plugin that handles this instead so developers can implement their own ranking/querying because it will vary site to site. The plugin could be a setting at the index level.

The current implementation can serve as the initial plugin, an example:

/**
 * Pure vector search ranker.
 */
#[SolrRanker(
  id: 'pure_vector',
  label: new TranslatableMarkup('Pure Vector'),
)]
class PureVector extends SolrRankerPluginBase {

  /**
   * {@inheritdoc}
   */
  public function applyRanking(SolariumQueryInterface $query, string $solr_field, int $top_k, array $vectors): SolariumQueryInterface {
    return $query->setQuery('{!knn f=' . $solr_field . ' topK=' . $top_k . '}[' . implode(', ', $vectors[0]) . ']');
  }

}
✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kevinquillen

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024