Provide a mechanism to combine vector search with traditional search
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3470414. -->
Reported by: [scott_euser](https://www.drupal.org/user/3267594)
Related to !133
>>>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>Vector search is good at retrieving top results based on keywords/phases while traditional search offers more filtering power than what vector databases often provide. </p>
<h4 id="summary-steps-reproduce">Steps to reproduce</h4>
<p>Attempt to combine eg a solr index and vector database </p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<p>TBD but perhaps a Plugin or processor of some sort to take the topK results from a vector search and prepend them to the search api query (both mysql/solr have mechanisms to provide a specific sort order of ids, followed be relevance as fallback order, I would expect other databases could do this too). </p>
<p>So essentially setting up two indexes, with eg solr as primary but enhanced with topK results from secondary. </p>
<p>We should probably give control in the plugin to allow the editor to choose between options like this:</p>
<ol>
<li>When an exact phrase is searched (ie, sets of quotes found) do not perform a vector database search</li>
<li>When an exact phrase is searched (ie, sets of quotes found) reduce the number of vector results to N results</li>
<li>When an exact phrase is searched (ie, sets of quotes found), behave the same as if no quotes are found</li>
</ol>
<p>We should also allow the site builder to specify the number of results to return in Topk by default, allowing them to override it in option 2.</p>
<h3 id="summary-remaining-tasks">Remaining tasks</h3>
<p>Prototype solution </p>
<h3 id="summary-ui-changes">User interface changes</h3>
<p>TBD </p>
<h3 id="summary-api-changes">API changes</h3>
<p>None</p>
<h3 id="summary-data-model-changes">Data model changes</h3>
<p>None</p>
issue