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.
Simple little addition.
Enable AJAX Autocomplete for Apache Solr Multisite Search module (http://drupal.org/project/apachesolr_multisitesearch).
Patch attached.
Comment | File | Size | Author |
---|---|---|---|
apachesolr_autocomplete-6.x-1.1-multisite.patch | 976 bytes | sdemi |
Comments
Comment #1
janusman CreditAttribution: janusman commentedSeems simple enough.
You need to mark things as "Needs review" to properly get my attention though =) Making it so.
Comment #2
janusman CreditAttribution: janusman commentedCommitted to HEAD (D7) and D6 branches.
Comment #4
DrupalGideonFor me, although this patch means that the autocomplete widget appears on the multisite form correctly, it's not actually suggesting words from the other multisites.
Comment #5
janusman CreditAttribution: janusman commentedDrat. I'm not really familiar with apachesolr_multiste and committing that patch was probably premature. To correctly fix this I'd really need to dig in or have someone more familiar with multisite to tell me what special solr params are being put in so I can make the autocomplete work correctly.
For now, should I revert the patch? Or is it better than nothing? Thoughts welcome.
Also, switching from bug report to feature request, since we're working on a feature.
Comment #6
DrupalGideonI had a look through the multisite code and it's to do with setting the hash param.
I managed to get the autocomplete to show on both the single search page and the multisite search page by adding
into the apachesolr_autocomplete_suggest function (before the modify query) but this isn't quite the desired effect. It only needs to work on the multisite form as in on search/apachesolr_multisitesearch and not search/apachesolr_search.
But by adding the $query->multisite = TRUE; with the multisite module enabled you will get multisite searches.
Comment #7
DrupalGideonI just tried a crude approach and got it to work.
In my own custom module, I wrote I set a hook_form_FORM_ID_alter() for the "search_form" and if the $form['module']['#value'] == 'apachesolr_multisitesearch' I did a variable_set to say that I was on the multisite.
I then wrote my own hook_apachesolr_modify_query() and checked if my variable was set to the multisite value, and if so I set $query->multisite = TRUE;
I had to change my custom module weight to -1 in order for it to work, my hook needed to be called before the hook_apachesolr_modify_query() in the apachesolr_multisitesearch module as that is what adds the hash filter.