summaryrefslogtreecommitdiffstats
path: root/module/database
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-05 23:21:44 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-03-05 23:21:44 +0100
commit9b12691ad66269ca8b67e80516548e8ae10bd7b2 (patch)
tree6df55bd94d02b216cb2ec51899f0d0e78899d3e2 /module/database
parentfixed position of autocompletion, updated libraries (diff)
downloadpyload-9b12691ad66269ca8b67e80516548e8ae10bd7b2.tar.xz
working search suggestions
Diffstat (limited to 'module/database')
-rw-r--r--module/database/FileDatabase.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py
index 9d11ffe46..557d9c034 100644
--- a/module/database/FileDatabase.py
+++ b/module/database/FileDatabase.py
@@ -164,6 +164,18 @@ class FileMethods(DatabaseMethods):
return data
@queue
+ def getMatchingFilenames(self, pattern, owner=None):
+ """ Return matching file names for pattern, useful for search suggestions """
+ qry = 'SELECT name FROM files WHERE name LIKE ?'
+ args = ["%%%s%%" % pattern.strip("%")]
+ if owner:
+ qry += " AND owner=?"
+ args.append(owner)
+
+ self.c.execute(qry, args)
+ return [r[0] for r in self.c]
+
+ @queue
def getAllPackages(self, root=None, owner=None, tags=None):
""" Return dict with package information