summaryrefslogtreecommitdiff
path: root/lib/search_engines.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-21 21:50:35 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-06-21 21:50:35 -0700
commit876ab059273a5f223170d6b2c0b9b4342b06c50f (patch)
tree5a3f32ead088c405bf24ddff361ed5cbed47db8c /lib/search_engines.php
parent02a4ca9e2ea46cb82829dc65e76efc36b0ec470b (diff)
Add like for search
Diffstat (limited to 'lib/search_engines.php')
-rw-r--r--lib/search_engines.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/search_engines.php b/lib/search_engines.php
index c98e8ed87..5c84d7c6b 100644
--- a/lib/search_engines.php
+++ b/lib/search_engines.php
@@ -131,6 +131,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)