diff --git a/etiquette/photodb.py b/etiquette/photodb.py index d02ba17..29a1b14 100644 --- a/etiquette/photodb.py +++ b/etiquette/photodb.py @@ -728,6 +728,7 @@ class PDBPhotoMixin: notnulls, minimums, maximums, + author_ids=authors, mmf_results=mmf_results, ) print(query[:200]) @@ -765,9 +766,9 @@ class PDBPhotoMixin: #print('Failed mimetype') continue - if authors and photo.author_id not in authors: - #print('Failed author') - continue + # if authors and photo.author_id not in authors: + # #print('Failed author') + # continue if filename_tree and not filename_tree.evaluate(photo.basename.lower()): #print('Failed filename') diff --git a/etiquette/searchhelpers.py b/etiquette/searchhelpers.py index b23d8fe..932b38f 100644 --- a/etiquette/searchhelpers.py +++ b/etiquette/searchhelpers.py @@ -6,10 +6,21 @@ from . import objects from voussoirkit import expressionmatch -def build_query(orderby, notnulls, minimums, maximums, mmf_results=None): +def build_query( + orderby, + notnulls, + minimums, + maximums, + author_ids=None, + mmf_results=None, + ): query = ['SELECT * FROM photos'] wheres = [] + if author_ids: + notnulls.add('author_id') + wheres.append('author_id in %s' % helpers.sql_listify(author_ids)) + if mmf_results: wheres.append('id %s %s' % (mmf_results['operator'], helpers.sql_listify(mmf_results['photoids'])))