diff options
| author | rr- | 2016-06-03 13:50:38 +0200 |
|---|---|---|
| committer | rr- | 2016-06-03 19:47:09 +0200 |
| commit | f0d3589344345f41ebf5593231287a923be45dbb (patch) | |
| tree | 289e155e54abf963bf1c952da386b23b846925d3 /server/szurubooru/search/executor.py | |
| parent | 59ad5fe40222a5b5402d5e31ec2a6c59f2f1b4bc (diff) | |
server/search: cache by query rather than its text
Diffstat (limited to 'server/szurubooru/search/executor.py')
| -rw-r--r-- | server/szurubooru/search/executor.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/server/szurubooru/search/executor.py b/server/szurubooru/search/executor.py index d4113be..c50712c 100644 --- a/server/szurubooru/search/executor.py +++ b/server/szurubooru/search/executor.py @@ -32,12 +32,13 @@ class Executor(object): Parse input and return tuple containing total record count and filtered entities. ''' - key = (id(self.config), query_text, page, page_size) - if cache.has(key): - return cache.get(key) search_query = self.parser.parse(query_text) + key = (id(self.config), hash(search_query), page, page_size) + if cache.has(key): + return cache.get(key) + filter_query = self.config.create_filter_query() filter_query = filter_query.options(sqlalchemy.orm.lazyload('*')) filter_query = self._prepare_db_query(filter_query, search_query, True) |