Author: peter
Date: 2008-11-10 17:55:23 -0800 (Mon, 10 Nov 2008)
New Revision: 1557

Modified:
   trunk/qubit/apps/qubit/lib/SearchIndex.class.php
   trunk/qubit/lib/model/QubitInformationObject.php
Log:
get search index to include all date types, not just creation

Modified: trunk/qubit/apps/qubit/lib/SearchIndex.class.php
===================================================================
--- trunk/qubit/apps/qubit/lib/SearchIndex.class.php    2008-11-11 01:50:45 UTC 
(rev 1556)
+++ trunk/qubit/apps/qubit/lib/SearchIndex.class.php    2008-11-11 01:55:23 UTC 
(rev 1557)
@@ -149,10 +149,10 @@
     $doc->addField($creatorField);
     $doc->addField(Zend_Search_Lucene_Field::Unstored('creatorhistory', 
strtolower($informationObject->getCreatorsHistoryString($language)), 
$encoding));
 
-    //CREATION DATES
-    if (count($dates = $informationObject->getDates($eventType = 'creation')) 
> 0)
+    //DATES
+    if (count($dates = $informationObject->getDatesString()) > 0)
     {
-      $doc->addField(Zend_Search_Lucene_Field::Text('dates', 
strtolower(implode(' ', $dates))));
+      $doc->addField(Zend_Search_Lucene_Field::Text('dates', 
strtolower($dates)));
     }
 
     // SCOPE AND CONTENT

Modified: trunk/qubit/lib/model/QubitInformationObject.php
===================================================================
--- trunk/qubit/lib/model/QubitInformationObject.php    2008-11-11 01:50:45 UTC 
(rev 1556)
+++ trunk/qubit/lib/model/QubitInformationObject.php    2008-11-11 01:55:23 UTC 
(rev 1557)
@@ -352,26 +352,18 @@
     return $thumbnails;
   }
 
-  public function getDates($eventType = 'creation')
+  public function getDates(array $options = array())
   {
     $criteria = new Criteria;
     $criteria->add(QubitEvent::INFORMATION_OBJECT_ID, $this->getId());
-    switch ($eventType)
+    $criteria->add(QubitEvent::START_DATE, null, Criteria::ISNOTNULL);
+    if (isset($options['type_id']))
     {
-      case 'creation' :
-        $criteria->add(QubitEvent::TYPE_ID, QubitTerm::CREATION_ID);
-        break;
+      $criteria->add(QubitEvent::TYPE_ID, $options['type_id']);
     }
     $criteria->addDescendingOrderByColumn(QubitEvent::START_DATE);
-    $events = QubitEvent::get($criteria);
 
-    $eventDates = array();
-    foreach ($events as $event)
-    {
-      $eventDates[] = $event->getDescription(array('cultureFallback' => true));
-    }
-
-    return $eventDates;
+    return QubitEvent::get($criteria);
   }
 
   public function getDatesOfDescription()
@@ -632,6 +624,25 @@
     }
   }
 
+  public function getDatesString()
+  {
+    if ($this->getDates())
+    {
+      $datesString = '';
+      $dates = $this->getDates();
+      foreach ($dates as $date)
+      {
+        $datesString .= $date->getDateDisplay().' ';
+      }
+
+      return $datesString;
+    }
+    else
+    {
+      return null;
+    }
+  }
+
   public function getSubjectsString($language)
   {
     $subjectString = '';


--~--~---------~--~----~------------~-------~--~----~
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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to