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]) . ']');
}
}
Comments
Comment #2
kevinquillen commentedComment #4
kevinquillen commentedThis merge introduces a new interface and plugin manager as well as moves some of the settings from the processor to the index. A starter plugin is included (PureVector) - from here others are able to develop their own manipulations to fit the use cases they need. There is no real way to solve every users needs in terms of ranking and quality, so this puts the power in their hands to develop around.
Comment #5
kevinquillen commented