Author: david
Date: Thu Jul  5 16:41:51 2012
New Revision: 11863

Log:
Add PDF text transcript to search index.  Fixes issue 1252.

Modified:
   trunk/lib/QubitSearchInformationObject.class.php

Modified: trunk/lib/QubitSearchInformationObject.class.php
==============================================================================
--- trunk/lib/QubitSearchInformationObject.class.php    Thu Jul  5 16:40:45 
2012        (r11862)
+++ trunk/lib/QubitSearchInformationObject.class.php    Thu Jul  5 16:41:51 
2012        (r11863)
@@ -96,7 +96,8 @@
       'start_date',
       'subject',
       'thumbnail_path',
-      'title'
+      'title',
+      'transcript'
     );
 
   /**
@@ -443,6 +444,12 @@
 
         break;
 
+      case 'transcript':
+        $field = Zend_Search_Lucene_Field::Unstored($camelName, 
$this->getTranscript());
+        $field->boost = 0.5;
+
+        break;
+
       // DATES
       case 'start_date':
       case 'end_date':
@@ -1062,4 +1069,32 @@
 
     return self::$statements['rights']->fetchAll(PDO::FETCH_CLASS);
   }
+
+  /**
+   * Get text transcript, if one exists
+   */
+  public function getTranscript()
+  {
+    if (!$this->__isset('digital_object_id'))
+    {
+      return;
+    }
+
+    if (!isset(self::$statements['transcript']))
+    {
+      $sql  = 'SELECT i18n.value
+        FROM '.QubitProperty::TABLE_NAME.' property
+        JOIN '.QubitPropertyI18n::TABLE_NAME.' i18n
+          ON property.id = i18n.id
+        WHERE property.name = "transcript"
+          AND property.source_culture = i18n.culture
+          AND property.object_id = ?';
+
+      self::$statements['transcript'] = self::$conn->prepare($sql);
+    }
+
+    
self::$statements['transcript']->execute(array($this->__get('digital_object_id')));
+
+    return self::$statements['transcript']->fetchColumn();
+  }
 }

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