markus_petrux - great work on the module!

When Block is enabled and used to initiate a search, the results are not returned. A blank form is currently returned instead.

Quick fix: In sphinxsearch.module, comment out lines that hide block as follows:

if ($delta == 'searchbox') {
// Hide block if current page is search.
//if (!sphinxsearch_is_search_path()) {
return array(
'subject' => t('Search'),
'content' => drupal_get_form('sphinxsearch_search_box'),
);
//}

Comments

markus_petrux’s picture

hmm... but then the block is also displayed on search pages, unless you tweak the block settings to hide per path (not sure, maybe).

I would prefer to find a method where the sphinxsearch module solves this issue by itself, which is why I used the check.

Could you please try this?

// Form is invoked for all pages to let the submit handler process requests.
$content = drupal_get_form('sphinxsearch_search_box');
// However, if current page is search, we can hide the block.
if (!sphinxsearch_is_search_path()) {
  return array('subject' => t('Search'), 'content' => $content);
}

That way the form code is invoked, loaded into the page, so the submit handler is there to process the form submission, which is the one that would redirect to search page with correct parameters in place.

markus_petrux’s picture

Status: Active » Needs review
zeezhao’s picture

Thanks. That works too.

Personally, I am okay with the block showing or not... Just wanted to make sure it displays results in order to avoid having to enter search keys twice. The search that comes with drupal core - at least in drupal 5.7 I'm using - always shows the search block.

markus_petrux’s picture

Status: Needs review » Reviewed & tested by the community

Having the searchbox block in the same search makes little sense, specially when the faceted search block is enabled. That's the main reason I was checking for that.

Anyway, glad it's working. I'll commit and release a new package, 1.2 for Drupal 5, so we can keep the issue as clean as a whistle. :)

markus_petrux’s picture

Status: Reviewed & tested by the community » Fixed

Fixed in CVS, release 1.2 is on the go. :)

markus_petrux’s picture

Status: Fixed » Closed (fixed)