Author: david
Date: Fri Feb 17 16:07:32 2012
New Revision: 10933

Log:
Fix linkage to collection root in search results.  Drop primary keys from 
search index.

Modified:
   trunk/apps/qubit/modules/search/templates/_searchResults.php
   trunk/lib/QubitSearchPdo.class.php

Modified: trunk/apps/qubit/modules/search/templates/_searchResults.php
==============================================================================
--- trunk/apps/qubit/modules/search/templates/_searchResults.php        Fri Feb 
17 15:58:06 2012        (r10932)
+++ trunk/apps/qubit/modules/search/templates/_searchResults.php        Fri Feb 
17 16:07:32 2012        (r10933)
@@ -78,8 +78,8 @@
         <?php echo render_show(__('Repository'), link_to($doc->repositoryName, 
array('slug' => $doc->repositorySlug, 'module' => 'repository'))) ?>
       <?php endif; ?>
 
-      <?php if ($doc->collectionRootId !== $doc->id): ?>
-        <?php echo render_show(__('Part of'), 
link_to($doc->collectionRootTitle, array('slug' => $doc->collectionRootSlug, 
'module' => 'informationobject'))) ?>
+      <?php if ($doc->collectionRootSlug !== $doc->slug): ?>
+        <?php echo render_show(__('Part of'), link_to($doc->partOf, 
array('slug' => $doc->collectionRootSlug, 'module' => 'informationobject'))) ?>
       <?php endif; ?>
 
     </div>

Modified: trunk/lib/QubitSearchPdo.class.php
==============================================================================
--- trunk/lib/QubitSearchPdo.class.php  Fri Feb 17 15:58:06 2012        (r10932)
+++ trunk/lib/QubitSearchPdo.class.php  Fri Feb 17 16:07:32 2012        (r10933)
@@ -203,7 +203,6 @@
     $doc = new Zend_Search_Lucene_Document;
 
     // Reference elements
-    $doc->addField(Zend_Search_Lucene_Field::Keyword('id', $resource->id));
     $doc->addField(Zend_Search_Lucene_Field::Keyword('slug', $resource->slug));
     $doc->addField(Zend_Search_Lucene_Field::Keyword('culture', 
$resource->culture));
     $doc->addField(Zend_Search_Lucene_Field::Keyword('className', 
'QubitInformationObject'));
@@ -287,17 +286,16 @@
     
$doc->addField(Zend_Search_Lucene_Field::Unstored('relatedunitsofdescription', 
$resource->related_units_of_description));
 
     // Collection root
-    $doc->addField(Zend_Search_Lucene_Field::UnIndexed('collectionRootId', 
$ancestors[0]->id));
-    $doc->addField(Zend_Search_Lucene_Field::Keyword('collectionRootSlug', 
$ancestors[0]->slug));
+    $collectionRoot = (0 < count($ancestors)) ?  $ancestors[0] : $resource;
+    $doc->addField(Zend_Search_Lucene_Field::UnIndexed('collectionRootSlug', 
$collectionRoot->slug));
 
     // Do fallback if current culture is not the same as the collectionRoot
-    $collectionRoot = (0 < count($ancestors)) ?  $ancestors[0] : $resource;
     $crTitle = $collectionRooot->title;
     if (0 == strlen($crTitle) || $collectionRoot->culture != 
$resource->culture)
     {
       $crTitle = self::getFallbackTitle($collectionRoot->id, array('culture' 
=> $resource->culture));
     }
-    $doc->addField(Zend_Search_Lucene_Field::UnIndexed('collectionRootTitle', 
$crTitle));
+    $doc->addField(Zend_Search_Lucene_Field::Keyword('partOf', $crTitle));
 
     // Add repository
     if (isset($options['repository']))

-- 
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