To get apachesolr_search.module to work, I had to add this line to the function "apachesolr_search_form_search_block_form_alter" :
$form['#action'] = url('search/apachesolr_search');

The three first lines of the function now looks like this:

function apachesolr_search_form_search_block_form_alter(&$form, $form_state) {
  if (variable_get('apachesolr_search_make_default', 0)) {
    $form['#action'] = url('search/apachesolr_search');

The reason for this, was that apachesolr always executed two searches after a search was made as can be seen from these screen shots.
First search:
http://img.skitch.com/20100822-fk4m2d7bcnrh53g8832h5jam6i.jpg
Second search, just following the first search:
http://img.skitch.com/20100822-ciauijb73bfbfs3ts73mu681q6.jpg

From the stack trace and the value for "action", the first search is executed because the search form is posted to the previous search url.

I've written "maybe" in the title, because I know we have done some hacking to the apachesolr modules to make them work with huge datasets (3-6 million nodes, 100.000-200.000 updated per day). So it might be that we have fucked up something while doing this. Please disregard this post if no one can reproduce this.

CommentFileSizeAuthor
#5 890314-search-block-action-5.patch786 bytespwolanin

Comments

pwolanin’s picture

There is a POST check that shoudl prevent the double search - can you check with an unmodified version of the function?

erlendstromsvik’s picture

Priority: Normal » Major

I just did a clean install of Drupal 6.17, apachesolr 6.x-1.2 and latest SolrPhpClient.
I then inserted some debug code in the apachesolr_search_search function in apachesolr_search.module.

This is the result:
http://img.skitch.com/20100826-g7q1in18r7da84qhu977s8y6r5.jpg

1 - Using the search block to do searches.
2 - Stack trace from first search execution done from the action-parameter, which really shouldn't happen. Since it's a huge performance killer
3 - Stack trace from second search execution, from whatever was entered in the search field at arrow #1
4 - The action parameter being populated by whatever is the request url.

Changed this to "major", since it is pretty major in my eyes.

I really don't understand why the action parameter is not set as default? What reason would one have to not be directed to the search/apachesolr_search path since that's were the module will send the user anyway?

pwolanin’s picture

So this only happens when using the search block on the search page?

pwolanin’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new786 bytes

just this one line change?

erlendstromsvik’s picture

Yes, only when using the search block. Probably should have specified that.

Yes, we only added that one line.

jpmckinney’s picture

Issue tags: +D6

Note: not an issue in 7.x

pwolanin’s picture

Status: Needs review » Fixed

committed

jpmckinney’s picture

Note: committed to both 6.1 and 6.2.

Status: Fixed » Closed (fixed)
Issue tags: -D6

Automatically closed -- issue fixed for 2 weeks with no activity.