Use SearchApiAiSearchBackend::getClient() and remove duplicate logic
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3539029. --> Reported by: [kim.pepper](https://www.drupal.org/user/370574) Related to !813 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>We have a method <code>\Drupal\ai_search\Plugin\search_api\backend\SearchApiAiSearchBackend::getClient()</code> that gets the vdb provider. However we repeat the same call to <code>$this-&gt;vdbProviderManager-&gt;createInstance($this-&gt;configuration['database']) </code>in multiple methods.</p> <h4 id="summary-steps-reproduce">Steps to reproduce (required for bugs, but not feature requests)</h4> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Remove the duplication and call <code>::getClient().</code></p> <p>Bonus points: consider renaming <code>::getClient()</code> to <code>::getVectorDB()</code> for readibility.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3>Optional: Other details as applicable (e.g., User interface changes, API changes, Data model changes)</h3>
issue