summaryrefslogtreecommitdiff
path: root/megapixels/app/models
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2019-01-12 00:16:29 +0100
committerJules Laplace <julescarbon@gmail.com>2019-01-12 00:16:29 +0100
commit433ad25335b94876710ea27fc0d0173f951a8440 (patch)
treef1b20dfa4e6e39cc8ddc201ef91297b473db116a /megapixels/app/models
parent334ea5a2a91da853dc6faf7f48aaa12599201218 (diff)
sql name search many terms
Diffstat (limited to 'megapixels/app/models')
-rw-r--r--megapixels/app/models/sql_factory.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/megapixels/app/models/sql_factory.py b/megapixels/app/models/sql_factory.py
index a580f28e..82e59b22 100644
--- a/megapixels/app/models/sql_factory.py
+++ b/megapixels/app/models/sql_factory.py
@@ -101,10 +101,12 @@ class SqlDataset:
def search_name(self, q):
table = self.get_table('identity_meta')
uuid_table = self.get_table('uuids')
+ identity_list = table.query.filter(table.fullname.like(q)).order_by(table.fullname.desc()).limit(10)
+ return identity_list
- identity = table.query.filter(table.fullname.like(q)).order_by(table.fullname.desc()).limit(30)
+ def get_uuids_for_identities(self, identity_list):
identities = []
- for row in identity:
+ for row in identity_list:
uuid = uuid_table.query.filter(uuid_table.id == row.image_id).first()
identities.append({
'uuid': uuid.toJSON(),