From: Dan Scott Date: Sat, 27 Aug 2011 20:33:15 +0000 (-0400) Subject: Issue #546: enable case-insensitive searching in MySQL X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=db9ac1a531c6dfb479c4cd6c9e242d79dd5d5fde;p=quix0rs-gnu-social.git Issue #546: enable case-insensitive searching in MySQL MySQL needs the collation utf8_general_ci to support case-insensitive searching. lib/mysqlschema.php already supports a 'collate' attribute on a per-column basis, so we just need to take advantage of that attribute on the columns we want to search and Bob (and BOB, and bOB) is your uncle. Signed-off-by: Dan Scott --- diff --git a/classes/Notice.php b/classes/Notice.php index 15696f6eef..60958c9e6a 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -92,7 +92,7 @@ class Notice extends Managed_DataObject 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), 'profile_id' => array('type' => 'int', 'not null' => true, 'description' => 'who made the update'), 'uri' => array('type' => 'varchar', 'length' => 255, 'description' => 'universally unique identifier, usually a tag URI'), - 'content' => array('type' => 'text', 'description' => 'update content'), + 'content' => array('type' => 'text', 'description' => 'update content', 'collate' => 'utf8_general_ci'), 'rendered' => array('type' => 'text', 'description' => 'HTML version of the content'), 'url' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL of any attachment (image, video, bookmark, whatever)'), 'created' => array('type' => 'datetime', 'not null' => true, 'description' => 'date this record was created'), diff --git a/classes/Profile.php b/classes/Profile.php index 06ea31c435..a6275cf451 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -55,12 +55,12 @@ class Profile extends Managed_DataObject 'description' => 'local and remote users have profiles', 'fields' => array( 'id' => array('type' => 'serial', 'not null' => true, 'description' => 'unique identifier'), - 'nickname' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username'), - 'fullname' => array('type' => 'varchar', 'length' => 255, 'description' => 'display name'), + 'nickname' => array('type' => 'varchar', 'length' => 64, 'not null' => true, 'description' => 'nickname or username', 'collate' => 'utf8_general_ci'), + 'fullname' => array('type' => 'varchar', 'length' => 255, 'description' => 'display name', 'collate' => 'utf8_general_ci'), 'profileurl' => array('type' => 'varchar', 'length' => 255, 'description' => 'URL, cached so we dont regenerate'), - 'homepage' => array('type' => 'varchar', 'length' => 255, 'description' => 'identifying URL'), - 'bio' => array('type' => 'text', 'description' => 'descriptive biography'), - 'location' => array('type' => 'varchar', 'length' => 255, 'description' => 'physical location'), + 'homepage' => array('type' => 'varchar', 'length' => 255, 'description' => 'identifying URL', 'collate' => 'utf8_general_ci'), + 'bio' => array('type' => 'text', 'description' => 'descriptive biography', 'collate' => 'utf8_general_ci'), + 'location' => array('type' => 'varchar', 'length' => 255, 'description' => 'physical location', 'collate' => 'utf8_general_ci'), 'lat' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'latitude'), 'lon' => array('type' => 'numeric', 'precision' => 10, 'scale' => 7, 'description' => 'longitude'), 'location_id' => array('type' => 'int', 'description' => 'location id if possible'),