From a000a3a2df5fcea91b0516e848f523baf927b714 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 15 Feb 2010 00:44:01 -0700 Subject: [PATCH] Content server: Use new exact matching for greater precision when generating OPDS catalogs. Also fix regression that broke rowsing by Tags on Stanza. --- src/calibre/library/database2.py | 2 +- src/calibre/library/server.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 31e742bc81..ed902c8ea4 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -283,7 +283,7 @@ class ResultCache(SearchQueryParser): if _match(q, vals, matchkind): matches.add(item[0]) continue - return matches + return matches def remove(self, id): self._data[id] = None diff --git a/src/calibre/library/server.py b/src/calibre/library/server.py index a1c8aec0bd..2f2fb3f58b 100644 --- a/src/calibre/library/server.py +++ b/src/calibre/library/server.py @@ -517,8 +517,8 @@ class LibraryServer(object): def get_matches(self, location, query): base = self.db.data.get_matches(location, query) - epub = self.db.data.get_matches('format', 'epub') - pdb = self.db.data.get_matches('format', 'pdb') + epub = self.db.data.get_matches('format', '=epub') + pdb = self.db.data.get_matches('format', '=pdb') return base.intersection(epub.union(pdb)) def stanza_sortby_subcategory(self, updated, sortby, offset): @@ -540,15 +540,15 @@ class LibraryServer(object): what, subtitle = sortby[2:], '' if sortby == 'byseries': data = self.db.all_series() - data = [(x[0], x[1], len(self.get_matches('series', x[1]))) for x in data] + data = [(x[0], x[1], len(self.get_matches('series', '='+x[1]))) for x in data] subtitle = 'Books by series' elif sortby == 'byauthor': data = self.db.all_authors() - data = [(x[0], x[1], len(self.get_matches('authors', x[1]))) for x in data] + data = [(x[0], x[1], len(self.get_matches('authors', '='+x[1]))) for x in data] subtitle = 'Books by author' elif sortby == 'bytag': data = self.db.all_tags2() - data = [(x[0], x[1], len(self.get_matches('tags', x[1]))) for x in data] + data = [(x[0], x[1], len(self.get_matches('tags', '='+x[1]))) for x in data] subtitle = 'Books by tag' fcmp = author_cmp if sortby == 'byauthor' else cmp data = [x for x in data if x[2] > 0]