Installed the search today. It is working great, expect that it shows the comments in the results where the anonymous user has no rights to access comments...

wondering if it is possible to force the search output only to show the node body and nothing else.

Comments

cpliakas’s picture

Hi snicers.

I took a look at the code, and it seems to be building the node body the same way as the core search module. Could you do me a favor and see if the core search is affected by this problems as well?

Thanks for the post,
Chris

nchase’s picture

Hi cpliakas, thanks.

The core search shows the same output in the results like the lucence search. I'm wondering why the comments are shown to users with no permission...

cpliakas’s picture

Title: Output of search results show comments even user has no rights to view » Output of search results show comments even though user has no rights to view
Version: 6.x-2.0-rc2 » 6.x-2.0
Assigned: Unassigned » cpliakas
Issue tags: +6.x-2.1

Looks like you have discovered a core bug :-) If you look at the "search" $op in node_search(), you will see on line 1283 in modules/node/node.module that it appends the comments to the node body without any access control. To me, that seems to be where the problem lies.

As for Search Lucene API, I think that this is a good bug report, and a fix can be applied to respect the comment permissions. I am flagging for the 6.x-2.1 release. As for an immediate fix, you can actually implement hook_luceneapi_result_alter() to control what is displayed. Unfortunately you will have to re-load the node, rebuild the body, and re-create the snippet which may be too performance intensive. I would wait for the upcoming release, which should happen in a week or so, maybe sooner.

Great catch!
Chris

nchase’s picture

thx :) I think I have to wait for the release. I'm more a user than a coder :)...

Should we adress this for core search as well and open a bug report?

cpliakas’s picture

To me, I think this should definitely be brought up to the core search maintainer. Let's see what they have to say about the issue. Feel free to reference the post here for a description of what is happening.

cpliakas’s picture

Status: Active » Fixed

Fix applied to Search Lucene API in commit #330200.

nchase’s picture

wow, that was fast... have to check later, thx!

Status: Fixed » Closed (fixed)
Issue tags: -6.x-2.1

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