We are using Search by page to search for content of panel bcz standard search can just index node, but our panels contain several node in one panel

We are using panels with parameters like
/panel1/par1+par2
after it we add URL alias to make URL like /panel1par1par2

URL like that was added to Search by Page/Path but when I try to search. It pick up only title of those pages but not the page content

Any ideas where to digg ?

Comments

eugeny44’s picture

I do some research and find out that
search_by_page.module line 539
$content = menu_execute_active_handler($path);

$content is empty, but $path is corrent

jhodgdon’s picture

That is very interesting. I'll have to do some tests with the panels module and see what is happening. Possibly the Panels module is not using the standard page generation mechanism to create the page.

jhodgdon’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

Well, I just ran a test. I downloaded Panels 6.x-3.3 and CTools (which it depends on), and enabled both Panels and Panel Nodes. I created a panel node, and put some node and block content into the panel. I then ran cron a couple of times to make sure everything got indexed.

Then I went to my Search by Page environment's search page, and I was able to search for both the panel title and words from inside the panel.

So I am not seeing this problem... I'm not sure what might be different, any ideas?

I guess you are using arguments with your panel. Can you try a panel without arguments and see if that works? If that works for you, please provide instructions for how you set up your panel with arguments, because I've never done that before and I'm not sure how that would work.

And are you using the same version of Panels as I used in my test, and creating Panel Nodes?

eugeny44’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Active

I change search_by_page.module line 539

  //$content = menu_execute_active_handler($path);
    $content = file_get_contents('http://www.example.com/'.$item->page_path);
    $delimeterLeft='<!-- start main content -->';
    $delimeterRight='<!-- end main content -->';
    $posLeft=strpos($content, $delimeterLeft); 
    $posLeft+=strlen($delimeterLeft); 
    $posRight=strpos($content, $delimeterRight, $posLeft); 
    $content = strip_tags(substr($content, $posLeft, $posRight-$posLeft));

reindex and search start working, without snipllets but work. So I thing its not a module problem but menu_execute_active_handler

I am using panels 6.x-3.0, for create panels with argument: you can create a Views with arguments, and that you add it to panel and use "Using arguments: %1/introduction" where %1 is argument from URL and "introduction" is second, to views its come as a two arguments.

jhodgdon’s picture

That is very odd and non-standard. Drupal normally gets/renders its pages through menu_execute_active_handler, and using file_get_contents() the way you have is not something that will work with generic pages.

I know about views with arguments, so I will make a test of panels with arguments and see what I can find out.

jhodgdon’s picture

Status: Active » Postponed (maintainer needs more info)

Hmmm... I still can't seem to create a panel with arguments. I have a view with arguments, but when I add it to a panel, Panels is not asking me anything about arguments, so I don't know how to indicate that. Like I said, I don't have experience with Panels with arguments... there must be some setting somewhere I am missing?

So I am still not sure what the problem is, since I cannot reproduce it on my machine. I tried a page View with arguments, and didn't have any problems seeing the page contents in search results.

Also, the solution you proposed in #4 will not work generally for Search by Page, as it depends on your particular theme.

So if you would like to debug further, and have a reasonably deep level of Drupal knowlege, you could try the following:

a) Look at $path and $parts right before the menu_execute_active_handler, and verify that they are pointing to the real path to the page you are trying to index (probably node/###/args?). Also you might look at $_GET, if the args are not in $path, as they would have been put there.

b) Call menu_get_item($path) and look at that. Verify that it has the right things for page callback and page arguments, which would probably be node_page_view for the page callback, and the node object and your page arguments in the page arguments array.

Beyond that, I don't know what to suggest...

jhodgdon’s picture

Never mind about the panels with args - I realized I needed to turn on a couple more modules: Page manager and Views Content Panes. Will test now...

jhodgdon’s picture

So.

I created a panels page with two arguments. When I go to URL
(my site URL)/my_test_of_panels/201003/4
I can see the page. It's displaying a view in the left pane with argument '201003', and node/4 in the second pane (that's the 4 argument).

It doesn't work for me with + signs in the URL - not sure what you are doing to use + signs...

Anyway, I added page my_test_of_panels/201003/4 to Search by Page and ran cron to make sure it was indexed.

I search for the word "testing", which is in the body but not the title of the page, and the panels page I have just created comes up in the search results.

So, I cannot reproduce the issue you are having... Any more ideas?

eugeny44’s picture

Got it,
I create clean file and move part of indexer to find out

in the $path correct URL for panel
but menu_execute_active_handler($path) returns NULL
If in $path URL to node('node') works just fine.

But if I add menu_set_active_item($path); before $content = menu_execute_active_handler($path); all start working as it should

search_by_page.module line 539

+menu_set_active_item($path);
$content = menu_execute_active_handler($path);

works for me

jhodgdon’s picture

I'll look into this...

jhodgdon’s picture

Status: Postponed (maintainer needs more info) » Fixed

Good idea on menu_execute_active_item()!

It looks like I had an equivalent line in the Drupal 7 version of this module, but it was missing from the Drupal 6 version.

I've just committed a change to the Drupal 6 development version that does the same thing (will be in any downloads of the module dated today or later, or you can get it immediately using CVS).

Status: Fixed » Closed (fixed)

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