You are here

function _as_configure_taxonomy in Apache Solr Attachments 5

Add taxonomy from the node to the solr document for the attachment.

1 call to _as_configure_taxonomy()
apachesolr_attachments_update_index in ./apachesolr_attachments.module
Hook is called by search.module to add things to the search index. In our case we will search content types and add any CCK type that is a file type that we know how to parse and any uploaded file attachments.

File

./apachesolr_attachments.module, line 350
Provides a file attachment search implementation for use with the Apache Solr module

Code

function _as_configure_taxonomy($document, $node) {
  if (is_array($node->taxonomy)) {
    foreach ($node->taxonomy as $term) {
      $document
        ->setMultiValue('tid', $term->tid);

      // Double indexing of tids lets us do effecient searches (on tid)
      // and do accurate per-vocabulary faceting.
      $document
        ->setMultiValue('imfield_vid' . $term->vid, $term->tid);
      $document
        ->setMultiValue('vid', $term->vid);
      $document
        ->setMultiValue('taxonomy_name', $term->name);
    }
  }
}