From dfa38c41418c3ea9c627dbcf4c85d18c5b451c4a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 19 May 2010 22:26:07 -0600 Subject: [PATCH] Fix broken series sorting --- src/calibre/library/caches.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/calibre/library/caches.py b/src/calibre/library/caches.py index e280a2178b..17853b818f 100644 --- a/src/calibre/library/caches.py +++ b/src/calibre/library/caches.py @@ -578,12 +578,14 @@ class ResultCache(SearchQueryParser): self._map_filtered = list(self._map) def seriescmp(self, x, y): + sidx = self.FIELD_MAP['series'] try: - ans = cmp(self._data[x][9].lower(), self._data[y][9].lower()) + ans = cmp(self._data[x][sidx].lower(), self._data[y][sidx].lower()) except AttributeError: # Some entries may be None - ans = cmp(self._data[x][9], self._data[y][9]) + ans = cmp(self._data[x][sidx], self._data[y][sidx]) if ans != 0: return ans - return cmp(self._data[x][10], self._data[y][10]) + sidx = self.FIELD_MAP['series_index'] + return cmp(self._data[x][sidx], self._data[y][sidx]) def cmp(self, loc, x, y, asstr=True, subsort=False): try: