I am using Organic Groups (OG) to separate public and private content by group. If I am a member of a group and search for content contained in a private/group article content type, search returns a hit. If I am not a member of a group and search for content contained in a private/group article content type, search doesn't return a hit. This is all well and good.

When I search on public file uploads, I get a hit. This too is good. However, when I am a member of a group and search on private/group file uploads, I don't get a hit. What is the deal-ee-oh?

EDIT

I am using Drupal 7.

The content type uses a field collection. The field collection uses a file field. The file field upload destination is set to private. Additionally, the content type uses OG Group Audience and Group Content Visibility to manage group access.

When I add new content using the above content type, and set the Group Visibility to private, the new content is not indexed by Drupal's Search.

I'd would like the new content to be indexed by Drupal's Search, but only provide hits to those users who are members of the group that are selected to have access to the new content. Currently, only the title is being indexed, not the file fields.

Using a similar content type, but with the file field upload set to public... new content added with content type group visibility set to public, the file field is indexed. I guess I will try adding new content using this content type, but with group content visibility set to private. Maybe this will tell me whether this is a OG issue or a file field issue.

Edit

Using the similar content type, but with the file field upload set to public... new content added with content type group visibility set to private still indexed properly (only showing hits to members of that group). Thus, this indexing issue appears to be affecting only file fields when the upload is set to private.

I'd rather not set the upload to public, so is there another way to get these fields indexed? Is this somehow related to the .htaccess file in the private folder or is this related to the Drupal 7 Search API or something else? Any insights are welcome.

Edit

I am going through the code of the file module now, but I don't understand how search determines whether or not to index a file. It must depend on one of these file settings, and I am guessing uri_scheme:

function file_field_info() {
  return array(
    'file' => array(
      'label' => t('File'),
      'description' => t('This field stores the ID of a file as an integer value.'),
      'settings' => array(
        'display_field' => 0,
        'display_default' => 0,
        'uri_scheme' => variable_get('file_default_scheme', 'public'),
      ),
      'instance_settings' => array(
        'file_extensions' => 'txt',
        'file_directory' => '',
        'max_filesize' => '',
        'description_field' => 0,
      ),
      'default_widget' => 'file_generic',
      'default_formatter' => 'file_default',
    ),
  );
}

Comments

buddym’s picture

Does anyone know why private files (file field type) are not being indexed??? I don't mind modifying core files to get these indexed.

buddym’s picture

Bump...