Convert search query to markdown
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3525470. --> Reported by: [ayrmax](https://www.drupal.org/user/1625944) Related to !622 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p> When searching for reference-style identifiers such as <code>A1_345/2003</code> or <code>E6_627/2024</code>, the search index does not return the expected content as the top result.<br> This appears to be due to markdown-sensitive characters not being handled in the query string, while they are escaped during indexing. </p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <ol> <li>Add content with identifiers like <code>A1_345/2003</code>.</li> <li>Index the content.</li> <li>Search using the raw identifier (e.g., <code>A1_345/2003</code>) in Vector DB Explorer.</li> <li>Observe that expected content is not the top result.</li> <li>Escape the query string as markdown would (e.g., <code>A1\_345/2003</code>) and search again.</li> <li>Note that the expected content is now ranked correctly.</li> </ol> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p> The search query should be preprocessed in the same way as indexed content&mdash;by escaping markdown characters&mdash;before embedding or querying.<br> A patch has been provided to escape the query using the same mechanism used during indexing (<code>HTMLtoMarkdown::convert()</code>). </p>
issue