Hi,

I'm surprised, there is no easy way to have solr autocomplete support because of the class of your search box.
How can we change easily and durably the class to have "apachesolr-autocomplete unprocessed form-text form-autocomplete"?

Good luck, continue to do your great job!

Comments

anydigital’s picture

Status: Active » Postponed (maintainer needs more info)

Sorry for the late response. Could you give me a link? Or copy and paste the piece of HTML markup?

bdeusanio’s picture

Hi,

I've activated your awesome theme. I've customised it, but i haven't custom your system.inc or search.inc
I've activated apache solr module.
When i submit a search via your block search form, i go back to search page with a blank keyword.

I should have search/!keyword
where !keyword is the value I wanted to search on.

Maybe search page can't retrieve the requested value.

Piece of code for solr autocomplete on garland :

<div class="form-item form-type-textfield form-item-search-block-form">
  <label class="element-invisible" for="edit-search-block-form--2">Rechercher </label>
 <input title="Indiquer les termes à rechercher" class="apachesolr-autocomplete unprocessed form-text form-autocomplete" type="text" id="edit-search-block-form--2" name="search_block_form" value="" size="15" maxlength="128" autocomplete="off">
</div>

on your theme :

<form class="search-form navbar-search navbar-search-elastic hidden-phone pull-right" action="/search/site" method="post" id="search-form" accept-charset="UTF-8"><input placeholder="Rechercher" class="search-query form-text form-search" type="search" id="edit-keys" name="keys" value="" size="40" maxlength="255"><input class="element-invisible btn btn-primary form-submit" type="submit" id="edit-submit--2" name="op" value="Rechercher"><input type="hidden" name="form_build_id" value="form-VHow-c3zEM_1LwEx3CVsLbhWdirZnZHc3JPUIUWR_7w">
<input type="hidden" name="form_token" value="6lbjzaS1SLhFms4bc8RgGcXluRCAFbiPSX42p95ZWFQ">
<input type="hidden" name="form_id" value="search_form">
</form>

Have a nice day,

continue your great job!

[EDIT] I've compared your theme with drupal bootstrap theme (project). The way the search block is manage is different, but it works with POST Mehtod. Maybe the key is in bootstrap/includes/form.inc.

Good luck

bdeusanio’s picture

the problem comes from the way you declare your search form and search form block.
I copy and past form.inc in your search.incl (redeclared in tweme_) and delete the preprocess_button (cause it's declared in your system.inc) and it works.

I don't really where the problem is, but I know you'll find why. I'm not as good as you to develop and fix that bug

bdeusanio’s picture

Version: 7.x-1.1-alpha3 » 7.x-1.2-alpha1

The solution explained juste before doesn't really work....
In fact, if you do what i've read, the search form will work but only on the page search/site. If you're not on this page it won't.
An example, if you're on the home page, and search 'foo', you'll be redirected to the http://my_drupal_website//foo
the search page path is not filled, and i don't understand why.

I've found another code to do the same thing:

$search_page = apachesolr_search_page_load('PAGE_ID');

module_load_include('inc', 'apachesolr_search', 'apachesolr_search.pages');
$build['search_form'] = drupal_get_form('apachesolr_search_custom_page_search_form', $search_page);

If you have any idea, please, feel free to help me.

Thanks

bdeusanio’s picture

To put on the autocomplete search-form, you have to modify your tweme_preprocess_page to add

    $form['basic']['keys']['#attributes']['class'][] = 'apachesolr-autocomplete';
    $form['basic']['keys']['#attributes']['class'][] = 'form-autocomplete';
    $form['basic']['keys']['#attributes']['class'][] = 'form-text';
    $form['basic']['keys']['#attributes']['class'][] = 'unprocessed';

It works

But if you click on any result you'll be redirected to the search/site page with no result since the search-form page path problem will be solved.

to remind you the problem, when you search anything on your navbar search block, the keywords you taped won't be used to the search, so it's no possible to use the navbar search.