Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The current results displayed in the autocomplete suggestions are based on which terms would return the most results. A site may want to prioritize certain suggestions even if they have fewer (but more important) results.
A custom module would be able to alter the suggestions if this module added a drupal_alter() in apachesolr_autocomplete_callback() before drupal_json_output($result).
For example:
// Invoke any modules that want to alter the results to show.
// function MODULENAME_apachesolr_autocomplete_results_alter(&$results) { }
drupal_alter('apachesolr_autocomplete_results', $results);
Comment | File | Size | Author |
---|---|---|---|
#1 | 2157713-1-by-DeFr-Allow-suggestions-to-be-alte.patch | 2.01 KB | DeFr |
Comments
Comment #1
DeFr CreditAttribution: DeFr commentedNeeded something like that for a project I'm working on.
Added an alter on the suggestions, to help adding suggestions without having to render them manually, and not rendering suggestions that would be removed.
Also added a matching .api.php file to document this new hook.
Comment #2
janusman CreditAttribution: janusman at Acquia commentedCommitted! Thanks!