diff --git a/server/szurubooru/search/configs/base_search_config.py b/server/szurubooru/search/configs/base_search_config.py index bb2cc0b1..350a54a8 100644 --- a/server/szurubooru/search/configs/base_search_config.py +++ b/server/szurubooru/search/configs/base_search_config.py @@ -10,6 +10,9 @@ class BaseSearchConfig(object): def create_filter_query(self): raise NotImplementedError() + def create_around_query(self): + return self.create_filter_query() + def create_count_query(self): return self.create_filter_query() diff --git a/server/szurubooru/search/configs/post_search_config.py b/server/szurubooru/search/configs/post_search_config.py index 4e4f69bb..686df4ff 100644 --- a/server/szurubooru/search/configs/post_search_config.py +++ b/server/szurubooru/search/configs/post_search_config.py @@ -78,6 +78,9 @@ class PostSearchConfig(BaseSearchConfig): new_special_tokens.append(token) search_query.special_tokens = new_special_tokens + def create_around_query(self): + return db.session.query(db.Post.post_id) + def create_filter_query(self): return self.create_count_query() \ .options( diff --git a/server/szurubooru/search/executor.py b/server/szurubooru/search/executor.py index 6df508af..13238632 100644 --- a/server/szurubooru/search/executor.py +++ b/server/szurubooru/search/executor.py @@ -31,7 +31,7 @@ class Executor(object): search_query = self.parser.parse(query_text) self.config.on_search_query_parsed(search_query) filter_query = self.config \ - .create_filter_query() \ + .create_around_query() \ .options(sqlalchemy.orm.lazyload('*')) filter_query = self._prepare_db_query(filter_query, search_query, False) prev_filter_query = filter_query \