Fix bug getTagsForBookmarks() that fetched all tags, see http://sourceforge.net/projects/semanticscuttle/forums/forum/759510/topic/3752670 for details

git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@715 b3834d28-1941-0410-a4f8-b48e95affb8f
This commit is contained in:
cweiske 2010-07-09 10:04:35 +00:00
parent 1962e3d2bc
commit 31570df64c
3 changed files with 12 additions and 6 deletions

View file

@ -1,6 +1,11 @@
ChangeLog for SemantiScuttle ChangeLog for SemantiScuttle
============================ ============================
0.9X.X - 2010-XX-XX
-------------------
- Fix bug getTagsForBookmarks() that fetched all tags
0.97.0 - 2010-06-09 0.97.0 - 2010-06-09
------------------- -------------------
- Many SQL optimizations - SemanticScuttle shows bookmarks 4 times faster now - Many SQL optimizations - SemanticScuttle shows bookmarks 4 times faster now

View file

@ -325,13 +325,8 @@ class SemanticScuttle_Service_Bookmark2Tag extends SemanticScuttle_DbService
return array(); return array();
} }
$sql = '';
foreach ($bookmarkids as $bookmarkid) {
$sql .= ' OR bId = ' . intval($bookmarkid);
}
$query = 'SELECT tag, bId FROM ' . $this->getTableName() $query = 'SELECT tag, bId FROM ' . $this->getTableName()
. ' WHERE (1' . $sql . ')' . ' WHERE bId IN (' . implode(',', $bookmarkids) . ')'
. ' AND LEFT(tag, 7) <> "system:"' . ' AND LEFT(tag, 7) <> "system:"'
. ' ORDER BY id, bId ASC'; . ' ORDER BY id, bId ASC';

View file

@ -171,6 +171,12 @@ class Bookmark2TagTest extends TestBase
$bid4 = $this->addBookmark(null, null, 0, array()); $bid4 = $this->addBookmark(null, null, 0, array());
//no tags //no tags
//bookmark that does not get queried
//http://sourceforge.net/projects/semanticscuttle/forums/forum/759510/topic/3752670
$bid5 = $this->addBookmark(null, null, 0, array());
$this->b2ts->attachTags($bid5, array('foo', 'bar2', 'fuu5'));
$alltags = $this->b2ts->getTagsForBookmarks( $alltags = $this->b2ts->getTagsForBookmarks(
array($bid1, $bid2, $bid3, $bid4) array($bid1, $bid2, $bid3, $bid4)
); );