]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Automatically add or drop fulltext indexes
[quix0rs-gnu-social.git] / classes / Profile.php
index 8cea91ece6e28ef88b82aa529d2ad01e7c19bf69..b8178e9b660ebbab3678d01469ba7eb27e8f4d62 100644 (file)
@@ -51,7 +51,7 @@ class Profile extends Managed_DataObject
 
     public static function schemaDef()
     {
-        return array(
+        $def = array(
             'description' => 'local and remote users have profiles',
             'fields' => array(
                 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'),
@@ -74,6 +74,14 @@ class Profile extends Managed_DataObject
                 'profile_nickname_idx' => array('nickname'),
             )
         );
+
+        // Add a fulltext index
+
+        if (common_config('search', 'type') == 'fulltext') {
+            $def['fulltext indexes'] = array('nickname' => array('nickname', 'fullname', 'location', 'bio', 'homepage'));
+        }
+
+        return $def;
     }
 
        function multiGet($keyCol, $keyVals, $skipNulls=true)