Searching multiple words in the keyword block (unexpected non-alpha-numeric character handling)

Justin W Freeman - November 2, 2009 - 02:09
Project:Faceted Search
Version:6.x-1.0-beta2
Component:General
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

My current set up:
Apache
PHP 5.2.11
MySQL 5.0.81
Drupal 6.13
Faceted search 6.x-1.0-beta2

This is the first time I have used this module and I am getting unexpected results when using non-alpha-numeric characters like spaces in the keyword search block.
This could be by design but I have not found any reference to this in the readme or anywhere else.

If I search for two words separated by a space I get a white screen.
If I search for two words separated by a forward slash I get search results for the two words ORed (what I would have expected from two words separated by a space).
If my search has pretty much any other symbol in it I get a white screen. For example #$()+[] etc.

Symbols are valid search characters and having to use slashes instead of spaces is very unusual.
I have never seen a search system fail when using symbols and I suspect my sites users would have no idea what is going on.

Is this the modules functionality (if so, for what reason?) or is this unexpected behavior that is being caused by my setup somehow?

Thanks

#1

Justin W Freeman - November 2, 2009 - 02:36

It seems to be related to this specific site as I have tried it on a brand new drupal install and I don't get the white screen problem.

Although it does seem to strip out a lot of punctuation.

#2

Justin W Freeman - November 2, 2009 - 04:15
Category:bug report» support request

I've now narrowed it down to the host. An exact copy of the site copied to a different server works correctly.

If anyone else has seen this behavior before and knows anything about it I'm open to suggestions.

#3

Justin W Freeman - November 2, 2009 - 04:20

I have updated to Drupal 6.14 so my current set up is:
Apache
PHP 5.2.11
MySQL 5.0.81
Drupal 6.14
Faceted search 6.x-1.0-beta2

Also, there is nothing in the watchdog log or the apache error log.

#4

Justin W Freeman - November 2, 2009 - 05:16

I have further narrowed it down to line 414 of faceted_search.module

There is something going on in that uasort call and its comparison function _faceted_search_compare_filters that is causing me to get a white screen, but not on all servers.

#5

Justin W Freeman - November 4, 2009 - 00:54

I have tracked this further now. I'm documenting it here in case anyone else has this odd problem.

It seems from my testing the problem is on line 451 of faceted_search.inc which is:

<?php
 
return $this->check_label(theme('faceted_search_keyword_and_label', $this->_word), $html);
?>

To be more particular, I isolated the problem to

<?php
  theme
('faceted_search_keyword_and_label', $this->_word)
?>

If I remove that part it works.
If I move that part out like this:

<?php
  $word
= theme('faceted_search_keyword_and_label', $this->_word);
  return
$this->check_label($word, $html);
?>

it doesn't work unless I comment out the line that calls theme().
It doesn't matter what is in the variable that gets sent to theme_faceted_search_keyword_and_label, it always seems to fail.

If you have this problem and you don't car about being able to theme that label text you can get around it by changing
the function get_label (line 450 of faceted_search.inc - there are other get_label functions that may or may not cause the same problem) to:

<?php
 
function get_label($html = FALSE) {
//    For some reason calling this theme function causes a crash when searching more than one word.
//    The theme function only does a check_plain so if the theme doesn't need to be overrided just skip the theme function.
//    return $this->check_label(theme('faceted_search_keyword_and_label', $this->_word), $html);
   
return $this->check_label(check_plain($this->_word), $html);
  }
?>

(the comments are just there so you know what is going on)

Does anyone have any idea what might cause this call to theme() to be a problem on one server and not another?
It is really strange.

#6

bradleyvance - November 12, 2009 - 21:04

Are you using "Zen" theme (or a sub-theme)?

I'm having the same issue but it only seems to happen for me if I'm using a variation of Zen.

I'm going to keep investigating.

#7

Justin W Freeman - November 13, 2009 - 02:58

It's actually a modified version of the acquia_slate theme

#8

bradleyvance - November 13, 2009 - 21:07

Yeah, never mind, I seem to be getting the error with all themes now. But as you mentioned it seems to be something that happens on one server and not another. I have a clone of my Drupal installation and database running on another machine with no problems! Both machines are Macs running MAMP, its really bizarre.

#9

phenaproxima - November 16, 2009 - 19:36

Yes, I was having this exact problem. Our theme is a modified version of Zen. Your fix worked fine for me...

#10

Justin W Freeman - November 16, 2009 - 23:41
Category:support request» bug report

I thought maybe it was a problem specific to my setup because no one had posted this issue before and it was very specific but it seems it is a problem.

 
 

Drupal is a registered trademark of Dries Buytaert.