Skip to content

Commit

Permalink
Merge pull request #13 from touri/master
Browse files Browse the repository at this point in the history
#2337 の修正
  • Loading branch information
balibali committed Sep 15, 2011
2 parents 223573f + 6a06c0b commit d9b1b21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/model/doctrine/PluginDiaryCommentTable.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,14 @@ protected function addSearchKeywordQuery(Doctrine_Query $q, $keywords)
{
foreach ($keywords as $keyword)
{
$q->andWhere('body LIKE ?', array('%'.$keyword.'%'));
if (method_exists($q, 'andWhereLike'))
{
$q->andWhereLike('body', array($keyword));
}
else
{
$q->andWhere('body LIKE ?', array('%'.$keyword.'%'));
}
}
}
}
5 changes: 5 additions & 0 deletions lib/model/doctrine/PluginDiaryTable.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@ protected function addSearchKeywordQuery(Doctrine_Query $q, $keywords)
{
foreach ($keywords as $keyword)
{
if (method_exists($q, 'escapePattern'))
{
$keyword = $q->escapePattern($keyword);
}

$q->andWhere('title LIKE ? OR body LIKE ?', array('%'.$keyword.'%', '%'.$keyword.'%'));
}
}
Expand Down

0 comments on commit d9b1b21

Please sign in to comment.