I make some test with Apache Solr Autocomplete and Apache Solr 6.x-3.0-rc1 modules. The autocomplete doesn't work in each case so i make my own autocomplete module with php code of 7.x series and js of 6.x series and it work. Sources are in the attach file.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nicja’s picture

Thanks for this.

I had to change the function apachesolr_autocomplete_do_alter on line 74 in apachesolr_autocomplete.module to set $element['#attributes']['class'] to a string instead of an array, in order to get the custom widget to work.

If $element['#attributes']['class'] is set as an array the class 'Array' is applied to the element insted of 'apachesolr-autocomplete unprocessed'

This is for a site running drupal 6.26

soulfroys’s picture

Hello @dhuygelaere!

Thank you for your code, works great! I just noticed that is not working in blocks...
Do you have this problem too?

I'm using:
- Apache Solr Search 6.x-3.x-dev (2013-Sep-16)
- Solr 4.4

Funksmaname’s picture

Thanks for this - working on search page - but as soulfroys said, not working on the search block... any advice??

Funksmaname’s picture

Also, this module is causing a 'security update available' warning on the site...?

kaythikhaing07’s picture

Issue summary: View changes
FileSize
17.98 KB

Thanks @n.dhuygelaere. I changed apachesolr_autocomplete_do_alter() on you source code and fixed for appearing on block and theme form.

function apachesolr_autocomplete_do_alter(&$element) {
if (apachesolr_autocomplete_variable_get_widget() == 'custom') {
// Create elements if they do not exist.
if (!isset($element['#attributes'])) {
$element['#attributes'] = array();
}
/*update START*/
if (!isset($element['#attributes']['class'])) {
$element['#attributes']['class'] = 'apachesolr-autocomplete unprocessed';
}
else {
$element['#attributes']['class'] .= ' apachesolr-autocomplete unprocessed';
}
/*update END*/
}
else {
$element['#autocomplete_path'] = 'apachesolr_autocomplete';
}
}