I've set up a live example of this strange bug:

http://funkty.db-dev.co.uk/about

The search block in the side bar is provided by a test eviron setup in search_by_page.

Searching for 'glass' provides successful results and proves that one of the paths I added to the envoron is working fine.

Searching for 'repertoire' produces the bug I'm concerned about. As you can see, the search results are somehow rendering my entire site twice, one on top of the other. Nasty! The bottom set of results are what I was hoping for.

I am also using the search_restrict module but I can reproduce the same bug with it disabled (I plan to uninstall his if I can get search_by_page to behave itself).

I've tried this in Garland too and it does the same thing so I've ruled out my custom theme. This theme is still under development but should work fine in Firefox, Chrome or Safari.

Any body have any ideas? Please help! I'd really like to get this working as you can probably imagine :)

Comments

jhodgdon’s picture

Category: bug » support
Priority: Major » Normal

My guess is that whatever you are using to generate the Music page (http://funkty.db-dev.co.uk/music) on your site, it's doing something it shouldn't be doing, or something that is at least incompatible with Search by Page.

During both search indexing and search results display (if you choose to display highlighted search excerpts), Search by Page must render the page it is trying to index or display as a result. Normally this is fine, but my guess is that that Music page is doing something strange... Most pages when you render them just return the HTML text to Search by Page (this is the "Drupal Way"); my guess is that the Music page is printing itself directly or outputting a page header or it has some funky PHP code in it (such as a drupal_goto(). That will not work with Search by Page.

I think you can probably get around this issue by telling Search by Page Paths to display a snippet rather than an excerpt in your page results, for this particular page. Then it won't try to render the page during search results display, and I suspect your problem will go away.

I would also suggest fixing whatever is displaying that Music page so that it does things the right Drupal-sanctioned way.

dddbbb’s picture

Issue tags: +panels

Thanks for the explanation / suggestion - that's certainly helped me understand what's going on.

Setting Snippet to 'no' in the Music path's settings seems to avoid the problem. However, it does look a little naked in the search results now - it would be nice to have the keyword highlighting back (I can live with it for now).

Funnily enough, /music is the only path that has been added to the search envrion that was created from scratch as a page in Panels (as in, not a node replacement Panel page like the blog posts for example). If this is indeed the cause of the problem, I'm unsure as to whether it would be classed as a Panels bug or a Search by Page bug. I'd be happy to post the bug report in the right place if someone could enlighten me.

jhodgdon’s picture

Title: Strange bug renders my site twice on certain search terms. » Panels page renders page header twice when it's a search result with excerpt

Rather than setting the snippet to 'no' or 'yes', you can type in a custom bit of text to use, such as a summary of that page. That wil make it less bare, and it should also avoid the problem.

I would also like to figure out what is going on though, even if you have a "fix". So can you describe a bit more what you've put on the panel page and how you created it, so I can try and reproduce the issue on my test box? I am somewhat familiar with Panels, but I had not actually tested panel pages with Search by Page. Also, the term "panel page" is rather ambiguous to me (there are several different kinds of panel page things available in Panels and its sub-modules), so be specific:
- which panels sub-modules are you using
- what did you click on in the admin interface to create the page
- what layout and options did you use (generally, I don't need all the specifics)
- what types of things did you put in each region (e.g., text blocks, blocks from a view, etc.)

Thanks!

dddbbb’s picture

Yeah, I saw that you could add custom text as the Snippet and have opted for that for now (until we get this Panels thing sorted - thanks for your enthusiasm on this).

Yes, 'Panel Page' could mean about 10 different things in Panels speak - I know exactly what you mean. I'll go away and put together some details for you.

dddbbb’s picture

Category: support » bug

Ok, here's how my Music page was created:

Enabled Panels sub-modules:
Mini panels
Panel nodes

Panel Page:
/admin/build/panels > Create new... Panel page.
(from here on probably isn't in order as I'm just referencing my Panel variant)...
Set path to 'music'.
Added menu entry to Primary links.
Selection rules: String: URL path - Current path is "music".
Layout: Single Column.
Content: View pane (Flash audio players), view (Repertoire: Node title & body, contains a link to a XLS file generated by views), view pane (Repertoire table).

Hope that helps. Let me know if you need anymore info.

I've got to update the live version now so the URL I provided in my initial post will no longer display the bug.

jhodgdon’s picture

Thanks for the details, and of course you need to fix your live site!

I will see if I can try this out sometime soon and see what's happening.

dddbbb’s picture

Nice one. Don't worry - the live site is just for testing.

dddbbb’s picture

Any progress with this?

jhodgdon’s picture

Sorry dixhuit, I was really really busy today and haven't had a chance to look further. All of my clients are clamoring for updates on their sites (not a terrible situation for a freelancer -- have to make a living), and I'm afraid volunteer work on Search by Page is not my highest priority. I do make time for SBP updates from time to time, but it's just not likely to happen this week.

dddbbb’s picture

No worries - totally understand.

jhodgdon’s picture

I took a look at the code in the Panels module, and I'm not sure why this would be happening, at least in panels 3.x (what version of panels are you using?).

However, I think I have a fix for this situation, where a page being rendered for excerpt generation could print something and screw up Search by Page. I'm working on this along with another issue:
#1040002: Active trail being set incorrectly

I'll report back when I have a viable patch that passes all my tests.

dddbbb’s picture

Thanks for the update. I am also using Panels 3.x.

jhodgdon’s picture

Status: Active » Needs review

I've just checked a fix for this into the DEV branch for 6.x. I'll also be porting it to 7.x. It's basically the patch at http://drupal.org/node/1040002#comment-4017026, with a few more PHP warning fixes added.

If you can test and see if this fixes your problem, that would be helpful. You should be able to download the dev version of the module within 12 hours or so.

jhodgdon’s picture

Version: 6.x-1.14 » 6.x-1.x-dev
Status: Needs review » Fixed

This fix is also done in the Drupal 7 dev version now.

I'll go ahead and mark this issue as fixed, until I hear otherwise, as I"m pretty sure this change will fix the problem.

dddbbb’s picture

Yes, this seems to have fixed things for me in Drupal 6. Many thanks!

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

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