Author: david
Date: Mon Feb 13 17:31:34 2012
New Revision: 10876

Log:
Add reference code

Modified:
   trunk/lib/QubitSearchPdo.class.php

Modified: trunk/lib/QubitSearchPdo.class.php
==============================================================================
--- trunk/lib/QubitSearchPdo.class.php  Mon Feb 13 15:48:15 2012        (r10875)
+++ trunk/lib/QubitSearchPdo.class.php  Mon Feb 13 17:31:34 2012        (r10876)
@@ -212,7 +212,38 @@
     $doc->addField($identifierField);
 
     // Reference code
-    //$doc->addField(Zend_Search_Lucene_Field::Text('referenceCode', 
$resource->referenceCode));
+    if ('1' == sfConfig::get('app_inherit_code_informationobject', 1) && null 
!= $resource->identifier)
+    {
+      $refcode = '';
+      if (isset($options['repository']))
+      {
+        if (null != $options['repository']->getCountryCode())
+        {
+          $refcode .= $options['repository']->getCountryCode().' ';
+        }
+
+        if (isset($options['repository']->identifier))
+        {
+          $refcode .= $options['repository']->identifier.' ';
+        }
+      }
+
+      $identifiers = array();
+      foreach (array_merge($ancestors, array($resource)) as $item)
+      {
+        if (isset($item->identifier))
+        {
+          $identifiers[] = $item->identifier;
+        }
+      }
+
+      $refcode .= implode(sfConfig::get('app_separator_character', '-'), 
$identifiers);
+    }
+    else
+    {
+      $refcode = $resource->identifier;
+    }
+    $doc->addField(Zend_Search_Lucene_Field::Text('referenceCode', $refcode));
 
     // Title
     // Include an i18n fallback for proper search result display in case the

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to