summaryrefslogtreecommitdiff
path: root/lib/search_engines.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2009-06-21 22:30:39 -0700
committerZach Copley <zach@controlyourself.ca>2009-06-21 22:30:39 -0700
commit9014a0a90d9ab5ee408aded51f379fd084fcd82c (patch)
treec30dea6917805d3218f030fc59185f00841e3abc /lib/search_engines.php
parentb8f3f32f3f12339c3838fcfc883815d63a36dca7 (diff)
parent876ab059273a5f223170d6b2c0b9b4342b06c50f (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
* '0.8.x' of git@gitorious.org:laconica/dev: Add like for search got rid of 'skin' concept a while ago add collecta.com link Update copyright dates in files modified in 2009 change Controlez-Vous to Control Yourself ignore config.php.* Position of max_file_size position helps IE
Diffstat (limited to 'lib/search_engines.php')
-rw-r--r--lib/search_engines.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/lib/search_engines.php b/lib/search_engines.php
index 0f405afbd..772f41883 100644
--- a/lib/search_engines.php
+++ b/lib/search_engines.php
@@ -1,7 +1,7 @@
<?php
/*
* Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, Controlez-Vous, Inc.
+ * Copyright (C) 2008, 2009, Control Yourself, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -139,6 +139,28 @@ class MySQLSearch extends SearchEngine
}
}
+class MySQLLikeSearch extends SearchEngine
+{
+ function query($q)
+ {
+ if ('identica_people' === $this->table) {
+ $qry = sprintf('(nickname LIKE "%%%1$s%%" OR '.
+ ' fullname LIKE "%%%1$s%%" OR '.
+ ' location LIKE "%%%1$s%%" OR '.
+ ' bio LIKE "%%%1$s%%" OR '.
+ ' homepage LIKE "%%%1$s%%")', addslashes($q));
+ } else if ('identica_notices' === $this->table) {
+ $qry = sprintf('content LIKE "%%%1$s%%"', addslashes($q));
+ } else {
+ throw new ServerException('Unknown table: ' . $this->table);
+ }
+
+ $this->target->whereAdd($qry);
+
+ return true;
+ }
+}
+
class PGSearch extends SearchEngine
{
function query($q)