I am working on a project that makes heavy use of OG. I noticed that when I enabled the Apache Solr OG module/facet block, it showed a number of search results showed up in "No Group". When I selected this filter, it appeared that only files were showing.

I'm not sure where the fix should be; should the apachesolr_og module figure out a file's gid by looking at the nodes it is attached to, or should apachesolr_attachments store the gid with the file?

Comments

ebeyrent’s picture

After looking at this issue a bit more, I think that the fix should be in the apachesolr_attachments module, because it creates a separate Lucene document for each file it indexes. The attached patch simply adds the appropriate OG key to the document. After I patched the module and re-indexed my files, the problem appeared to be fixed.

ebeyrent’s picture

Status: Active » Needs review
pwolanin’s picture

Project: Apache Solr Attachments » Apache Solr Organic Groups Integration
Version: 6.x-2.x-dev »
Status: Needs review » Needs work

No. This needs to be handled by the _og module. the attachments module should not know anything about groups.

pwolanin’s picture

On approach is to use this hook:

      drupal_alter('apachesolr_attachment_index', $document, $node, $file);

The existing nodeaccess bit is a bit of an ugly hack and I'd rather not extend it.

ideally we should have a more generic hook that can alter documented created from or related to a specific node.

For 6.x-1.x I'm not sure sure a change is in scope - we coudl basiclaly use hook_apachesolr_update_index() if we indicate that modules implementing it may need to check $document->entity to decide whether to act, and maybe pass $entity as an option third parameter?

ebeyrent’s picture

I did think about that, but instead elected to go with a solution consistent with how taxonomy and nodeaccess are handled in the attachments code.

I like your idea about extending the hook though.

jsagotsky’s picture

Version: » 6.x-2.x-dev
StatusFileSize
new1.02 KB

ebeyrent, we still use your patch at OpenScholar, but had to make some changes to get it to apply to 6.x-1.0-beta1. See attached.

jsagotsky’s picture

Err, try this attachment. Last one didn't stick.

nick_vh’s picture

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

6.x-2.x has become unsupported