Download & Extend

Apache Solr "Did you mean" loses search parameter from 404 page

Project:Search 404
Version:6.x-1.9
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

When executing a search for "suport", Apache Solr search results page displays "Did you mean: support" which links to http://mysite.com/search/apachesolr_search/support. Clicking on the link works as expected.

Visiting http://mysite.com/suport the search404 results page displays "Did you mean: support" but the link points to http://mysite.com/search/%252Fsupport. Clicking on the link redirects to http://mysite.com/search/apachesolr_search but the search parameter, "support", is lost.

Anyone else experiencing this same behavior?

Comments

#1

Title:Apache Solr "Did you mean" looses search parameter from 404 page» Apache Solr "Did you mean" loses search parameter from 404 page

fix typo in title

#2

Do you still face this issue? Has somebody else faced this issue? The search results and the suggestions are generated by Solr. I am not sure how search404 can affect that.

#3

We noticed this issue the other day. I was able to fix it on a test site by moving the "EVIL HAXX" from being around the theme() call to instead being around the module_invoke() call.

I'm not sure what other implications that change may have so instead of submitting a patch I'll let you take a look.

#4

@machee - Thanks for looking into this.

%252F is double URL encoded /. So somewhere / is being passed unnecessarily.

Can you please try

drupal_set_message('keys(): '. var_export($keys, TRUE));

right before the module invoke call and see if there is any slashes in the keys. Not sure if solr uses data from the URL other than whatever is passed as keys.

I have raised an issue at the ApacheSolr queue as well - #1235022: Search404 integration with ApacheSolr - Issue with "Did you mean"

#5

I put my fix in production and haven't looked at it in a while.

The extra slash is there, but I seem to remember the main problem being that "apachesolr_search" is missing from the link. It should be

/search/apachesolr_search/newterm

Seems like I remember the part labeled "EVIL HAXX" having no real effect on the theme() call, but when looking at the output from module_invoke() it seemed like it needed the changes to return the expected link. And that did fix it for me.

Maybe it just doesn't affect the theme() call for my particular theme, so maybe it's needed for both places.

#6

machee, how are you addressing this issue now, since it's been a while since you posted this and search404 is up to 6.x-1.11 stable at this point?

#7

I'm not able to look into this further at this point, but my guess is that the way to deal with this would be to look at the how search404 is working with the current path and how this is getting picked up in apachesolr_search.

I needed to get something up and running on a D6 site, so the fix that I'm deciding to go with at this point is to use apachesolr-6.x-1.x-dev which adds a theme them_apachesolr_search_suggestions() function and just throwing this in my theme's template.php file:

<?php
function [MY THEME NAME]_apachesolr_search_suggestions($links) {
 
$output = '<div class="spelling-suggestions">';
 
$output .= '<dl class="form-item"><dt><strong>' . t('Did you mean') . '</strong></dt>';
  foreach ((array)
$links as $link) {
   
$output .= '<dd>' . str_replace('/search/%252F', '/search/apachesolr_search/', $link) . '</dd>';
  }
 
$output .= '</dl></div>';
  return
$output;
}
?>

#8

Status:active» closed (duplicate)

See patch in #1235022: Search404 integration with ApacheSolr - Issue with "Did you mean"

Will mark this as duplicate and close the issue.

nobody click here