Search_attachments search breaks the Content search

transformative - March 10, 2009 - 17:33
Project:Search All
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:minor
Assigned:Unassigned
Status:active
Description

I have the search_attachments module installed (http://drupal.org/project/search_attachments).

When I do a search with search_all, my Content results (which appear below the Search_attachments results) look something like this:

Anonymous
...
Anonymous
...
Anonymous
...

(If I do a search using the Content search tab, I get correct results for real nodes, and not these "Anonymous" results).

Based on some tests I've done with the code, it appears that the Search_attachments results are messing up the Content search results: maybe Search_attachments is resetting a variable, or perhaps the formatting is being thrown off by something in the results text (such as a misplaced, unescaped quote). If I remove the Search_attachments results from search_all, everything works fine.

I fixed this problem by reversing the order in which the searches happen (which i needed do anyway, because I prefer to have the content results first and the user results last). Around line 86, I changed this line:

foreach (module_list() as $type) {

to this instead:

foreach (array_reverse(module_list()) as $type) {

I am sharing this problem in case it's useful to anyone who is having the same problem. it's not the ideal solution, and it's possible that there is another change that could be done to the search_all or search_attachments module that would fix this problem. However, this worked for me in the interim.

 
 

Drupal is a registered trademark of Dries Buytaert.