I have the commentsearch module installed but the comments are not being indexed. Am I missing a configuration someplace?
Is there any reason why comments might not be indexed?

Comments

tbenice’s picture

solr index page shows that 169 documents are in the index, so this is not an indexing issue. The comments are not displayed in the search results.

tbenice’s picture

Title: Comments not indexing » Comments not showing in results

changing the title

tbenice’s picture

This is still a problem for me and I cant figure out why it doesn't work. Has anybody else had a similar problem?

tbenice’s picture

Looking at the index, I see that there are the correct number of terms for is_cid, but not for 'type'. I have 11 content types that have indexable content. The 'type' term shows 11, and should be 12 I think including the 'comment' type. I think maybe the 'comment' type is missing?
EDIT: Nope, I was wrong, i think. I enabled the 'content type' filter in the results and I actually only have content in 10/11 types, so probably 'comment' is one of the 11 in the index. Any way to tell? All I know is that when apachesolr_commentsearch_apachesolr_search_result_alter is called, the conditional statement ($doc->type == 'comment') is never true.

tbenice’s picture

When I go to the solr admin page to query (http://localhost:8983/solr/admin/form.jsp) and type in 'type:comment' into Solr/Lucerne statement, I get comments as results. the comments are definitely there, they are not being returned to Drupal for some reason. When I watchdog $doc-type in apachesolr_search_process_response inside the loop (foreach ($response->response->docs as $doc)), i only get my normal content types, not 'comment'.

tbenice’s picture

Title: Comments not showing in results » Comments only shown to users with 'administer nodes' permission

It's a permissions problem. I found it logged in as user 1 that I could see the comments at search/apachesolr_search. If I give a test user 'administer nodes' permission, they can see comments too.

Looking for why administer nodes is needed to return comments from solr. Also changing the name of this issue.

tbenice’s picture

Title: Comments only shown to users with 'administer nodes' permission » apachesolr_nodeaccess required 'administer nodes' permission to retrieve non-node content (comments and files)

The problem is that the apachesolr_nodeaccess module is not compatible with apachesolr_commentsearch. the apachesolr_nodeaccess module checks for grants on nodes only, not other content like comments or files. This is also probably the reason for http://drupal.org/node/387442.

tbenice’s picture

Category: support » bug
Priority: Normal » Major

Changing to a bug, as nodeaccess should not interfere with commentsearch.

tbenice’s picture

I found the problem, which is actually in apachesolr_commentsearch.module. I'll work up a patch and submit it for review tonight.

tbenice’s picture

Here's a patch against 2.x-dev that does the following:
1) invokes hook_apachesolr_update_index. This is needed to allow apachesolr_nodeaccess to add the required terms to comment documents so that that modules added filters will not filter out all comments.
2) adds a new term to differentiate comment documents from non-comment documents.
3) adds a new filter to filter out comment documents if the current user does not have access comments permissions.

I modeled the approach used in apachesolr_nodeacess for this.

thanks!

tbenice’s picture

Status: Active » Needs review
tbenice’s picture

Version: 6.x-2.0-beta3 » 6.x-2.x-dev
jpmckinney’s picture

Title: apachesolr_nodeaccess required 'administer nodes' permission to retrieve non-node content (comments and files) » [apachesolr_commentsearch] Incompatibility with apachesolr_nodeaccess

Waiting for new component to tag issue.

jpmckinney’s picture

Add tag

nick_vh’s picture

Status: Needs review » Closed (won't fix)

Not sure if this is portable to 6.x-1.x branch but closing this since 6.x-2.x branch is unsupported.