AI Search: Pass metric type to vector search function
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3486166. --> Reported by: [joshhytr](https://www.drupal.org/user/3633353) Related to !252 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>Postgres (pgvector) uses the metric at search time (AiVdbProvider::vectorSearch()) rather than when the collection is created.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Pass the configured metric type to the vectorSearch() function as well as createCollection(). This will support both variants.</p> <h3 id="summary-api-changes">API changes</h3> <p>Change to SearchApiAiBackend::doSearch() to include the metric type in active config to the vdb provider vectorSearch() method.</p> <p>Update AiVdbProviderInterface::vectorSearch() to accept VdbSimilarityMetrics $metric_type as a param. This will require that implementing providers update their vectorSearch method signatures.</p> > Related issue: [Issue #3498534](https://www.drupal.org/node/3498534) > Related issue: [Issue #3512333](https://www.drupal.org/node/3512333)
issue