Bug 139002

Summary: search in collection browser returns inaccurate results
Product: [Applications] amarok Reporter: Ljubomir <ljubomir>
Component: Collection BrowserAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 1.4-SVN   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Ljubomir 2006-12-19 10:08:28 UTC
Version:           1.4-SVN (using KDE 3.5.4, Kubuntu Package 4:3.5.4-0ubuntu2~dapper1 )
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.15-27-k7

Entering any search term in "Search" field of Collection browser, returns only one track: "Fill Me" by Acid Drinkers. This track is not the first one in collection, nor is the only track by Acid Drinkers. Before entering any search term, my full collection is shown in the browser. I have done full rescan of collection, but it doesn't seem to affect bug. 
I'm using revision 614862.

This problem occurred as soon as bug 138913 has been fixed.
Comment 1 highelf 2006-12-19 10:54:39 UTC
Same here, except I get alway the 3 same results no matters what I search.
Comment 2 Sven Krohlas 2006-12-19 11:14:29 UTC
Same here, always the same results. And all contain the per cent sign %.
Comment 3 Maximilian Kossick 2006-12-19 11:37:57 UTC
the search is broken using a sqlite database, but works with MySql. There are no sql errors im Amarok's debug output.
Comment 4 Alexandre Oliveira 2006-12-19 11:42:27 UTC
I broke something in the like function, then.
Comment 5 Alexandre Oliveira 2006-12-20 01:04:13 UTC
SVN commit 615053 by aoliveira:

Oops...
Fix the search problems with sqlite.
BUG: 139002


 M  +3 -2      collectiondb.cpp  


--- trunk/extragear/multimedia/amarok/src/collectiondb.cpp #615052:615053
@@ -6241,9 +6241,10 @@
 
     int begin = pattern.startsWith( "%" ), end = pattern.endsWith( "%" );
     if (begin)
-        pattern = pattern.right( 1 );
+        pattern = pattern.right( pattern.length() - 1 );
     if (end)
-        pattern = pattern.left( pattern.length() - 2 );
+        pattern = pattern.left( pattern.length() - 1 );
+
     if( argc == 3 ) // The function is given an escape character. In likeCondition() it defaults to '/'
         pattern.replace( "/%", "%" ).replace( "/_", "_" ).replace( "//", "/" );
 
Comment 6 Ljubomir 2006-12-20 13:59:21 UTC
Yeah, fixed. Thx!