From be9828997eea337bd3fbd8e0a52c3b249ac8a156 Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Wed, 25 Nov 2015 12:23:50 +0100 Subject: [PATCH] Bug #1519599: search/replace on a custom series column resets the index. Kovid: as you can see the problem is in db.cache.set_field. I fixed it by using the custom series index if there is one. I don't think that this change has any undesirable side effects but I am not as familiar with the new db as I should be. --- src/calibre/db/cache.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index b739beb989..c45dc428c6 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -1042,7 +1042,8 @@ class Cache(object): else: v = sid = None if name.startswith('#') and sid is None: - sid = 1.0 # The value will be set to 1.0 in the db table + extra = self.field_for(name + '_index', k) + sid = extra if extra else 1.0 # The value to be set the db link table bimap[k] = v if sid is not None: simap[k] = sid