diff --git a/lib/filestorage/common.php b/lib/filestorage/common.php
index fa14d7e99fd6727692e824a42ea7084ca5d4adae..fa0e7babf5647344e782a11037a114ae11f686f8 100644
--- a/lib/filestorage/common.php
+++ b/lib/filestorage/common.php
@@ -106,7 +106,9 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
 		return $hash;
 	}
 // 	abstract public function free_space($path);
-// 	abstract public function search($query);
+	public function search($query){
+		return $this->searchInDir($query);
+	}
 	public function getLocalFile($path){
 		return $this->toTmpFile($path);
 	}
@@ -122,4 +124,21 @@ abstract class OC_Filestorage_Common extends OC_Filestorage {
 		return $tmpFile;
 	}
 // 	abstract public function touch($path, $mtime=null);
+
+	protected function searchInDir($query,$dir=''){
+		$files=array();
+		$dh=$this->opendir($dir);
+		if($dh){
+			while($item=readdir($dh)){
+				if ($item == '.' || $item == '..') continue;
+				if(strstr(strtolower($item),strtolower($query))!==false){
+					$files[]=$dir.'/'.$item;
+				}
+				if($this->is_dir($dir.'/'.$item)){
+					$files=array_merge($files,$this->searchInDir($query,$dir.'/'.$item));
+				}
+			}
+		}
+		return $files;
+	}
 }
diff --git a/lib/filestorage/commontest.php b/lib/filestorage/commontest.php
index 512e7c1b66d05329914a3731368cb071f3680383..1b01ff856a358c945cc30b122d78108e1daed304 100644
--- a/lib/filestorage/commontest.php
+++ b/lib/filestorage/commontest.php
@@ -69,9 +69,6 @@ class OC_Filestorage_CommonTest extends OC_Filestorage_Common{
 	public function free_space($path){
 		return $this->storage->free_space($path);
 	}
-	public function search($query){
-		return $this->storage->search($query);
-	}
 	public function touch($path, $mtime=null){
 		return $this->storage->touch($path,$mtime);
 	}
diff --git a/tests/lib/filestorage.php b/tests/lib/filestorage.php
index 6296d7abf99cfbf784da639db67ab32dd2dd909f..f8d4d9c4395d8f8042bc460a4ef50dc44e89bca8 100644
--- a/tests/lib/filestorage.php
+++ b/tests/lib/filestorage.php
@@ -156,9 +156,10 @@ abstract class Test_FileStorage extends UnitTestCase {
 		$this->assertTrue($mTime<=$mtimeEnd);
 		$this->assertEqual($cTime,$originalCTime);
 		
-		$this->instance->touch('/lorem.txt',100);
-		$mTime=$this->instance->filemtime('/lorem.txt');
-		$this->assertEqual($mTime,100);
+		if($this->instance->touch('/lorem.txt',100)!==false){
+			$mTime=$this->instance->filemtime('/lorem.txt');
+			$this->assertEqual($mTime,100);
+		}
 		
 		$mtimeStart=time();
 		$fh=$this->instance->fopen('/lorem.txt','a');
@@ -171,4 +172,17 @@ abstract class Test_FileStorage extends UnitTestCase {
 		$this->assertTrue($mtimeStart<=$mTime);
 		$this->assertTrue($mTime<=$mtimeEnd);
 	}
+
+	public function testSearch(){
+		$textFile=OC::$SERVERROOT.'/tests/data/lorem.txt';
+		$this->instance->file_put_contents('/lorem.txt',file_get_contents($textFile,'r'));
+		$pngFile=OC::$SERVERROOT.'/tests/data/logo-wide.png';
+		$this->instance->file_put_contents('/logo-wide.png',file_get_contents($pngFile,'r'));
+		$svgFile=OC::$SERVERROOT.'/tests/data/logo-wide.svg';
+		$this->instance->file_put_contents('/logo-wide.svg',file_get_contents($svgFile,'r'));
+		$result=$this->instance->search('logo');
+		$this->assertEqual(2,count($result));
+		$this->assertNotIdentical(false,array_search('/logo-wide.svg',$result));
+		$this->assertNotIdentical(false,array_search('/logo-wide.png',$result));
+	}
 }