Complex AI search queries are not supported
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3472394. --> Reported by: [marcus_johansson](https://www.drupal.org/user/385947) Related to !59 !58 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>When the query that goes into AI Search from Search API is created, there are parse modes that can intercept and transoform the query. This means for instance that the following searches are different:</p> <p>Who is Michael Jackson<br> "Who is Michael Jackson"<br> Who+Is+Michael+Jackson</p> <p>You can see how these are implemented here: <a href="https://git.drupalcode.org/project/search_api/-/blob/8.x-1.x/src/ParseMode/ParseModeInterface.php?ref_type=heads">https://git.drupalcode.org/project/search_api/-/blob/8.x-1.x/src/ParseMode/ParseModeInterface.php?ref_type=heads</a></p> <p>This will produce the output that is seen there in parseInput method, which means that we can get back a complex array that looks like this instead of a string or array with just one string:</p> <pre>[#conjunction] = AND<br>[0] = Who<br>[1] = is<br>[2] = Michael<br>[3] = Jackson</pre><p>At the moment we just pass the first in the array if its an array, which means that in the above case we search for "Who", which makes no sense.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Try to search for "Who is Michael Jackson" and you will get very low scores.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>Since boolean searches and other advanced methods matters less and you can actually just prompt it - find the exact match "Who is Michael Jackson" we could just take the array and remove the conjunction and pass it.</p> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3>
issue